You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/04/30 01:31:04 UTC

[incubator-nuttx] branch master updated (d0bb7c1 -> 1aa9ff8)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from d0bb7c1  Use NuttX's signal set functions inside the OS.
     new f23a756  arch/z16:  Correct file naming for coding standard
     new 1aa9ff8  Run .c and .h files in this PR through nxstyle and fix complaints

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/z16/src/common/up_allocateheap.c              | 112 -------------------
 arch/z16/src/common/up_arch.h                      |  52 ---------
 arch/z16/src/common/up_copystate.c                 |  63 -----------
 arch/z16/src/common/up_doirq.c                     | 115 --------------------
 arch/z16/src/common/up_initialstate.c              |  79 --------------
 arch/z16/src/common/up_interruptcontext.c          |  63 -----------
 arch/z16/src/common/up_mdelay.c                    |  73 -------------
 arch/z16/src/common/up_registerdump.c              |  89 ---------------
 arch/z16/src/common/up_stackdump.c                 |  94 ----------------
 arch/z16/src/common/z16_allocateheap.c             |  89 +++++++++++++++
 arch/z16/src/common/z16_arch.h                     |  37 +++++++
 arch/z16/src/common/{up_assert.c => z16_assert.c}  |  68 +++++-------
 .../src/common/{up_blocktask.c => z16_blocktask.c} |  43 +++-----
 arch/z16/src/common/z16_copystate.c                |  48 ++++++++
 .../common/{up_createstack.c => z16_createstack.c} |  47 +++-----
 arch/z16/src/common/z16_doirq.c                    | 100 +++++++++++++++++
 arch/z16/src/common/{up_exit.c => z16_exit.c}      |  52 +++------
 arch/z16/src/common/{up_idle.c => z16_idle.c}      |  43 +++-----
 .../common/{up_initialize.c => z16_initialize.c}   |  51 +++------
 arch/z16/src/common/z16_initialstate.c             |  64 +++++++++++
 .../src/common/{up_internal.h => z16_internal.h}   |  96 +++++++---------
 arch/z16/src/common/z16_interruptcontext.c         |  48 ++++++++
 arch/z16/src/common/z16_mdelay.c                   |  58 ++++++++++
 arch/z16/src/common/z16_registerdump.c             |  75 +++++++++++++
 .../{up_releasepending.c => z16_releasepending.c}  |  44 +++-----
 .../{up_releasestack.c => z16_releasestack.c}      |  43 +++-----
 ...{up_reprioritizertr.c => z16_reprioritizertr.c} |  50 +++------
 ...schedulesigaction.c => z16_schedulesigaction.c} |  60 ++++------
 .../common/{up_sigdeliver.c => z16_sigdeliver.c}   |  52 +++------
 arch/z16/src/common/z16_stackdump.c                |  82 ++++++++++++++
 .../common/{up_stackframe.c => z16_stackframe.c}   |  54 +++------
 arch/z16/src/common/{up_udelay.c => z16_udelay.c}  |  61 +++--------
 .../common/{up_unblocktask.c => z16_unblocktask.c} |  43 +++-----
 .../src/common/{up_usestack.c => z16_usestack.c}   |  43 +++-----
 arch/z16/src/z16f/Make.defs                        |  53 ++++-----
 arch/z16/src/z16f/chip.h                           |  79 ++++++--------
 arch/z16/src/z16f/z16f_espi.c                      |  53 ++++-----
 arch/z16/src/z16f/z16f_head.S                      |  51 +++------
 arch/z16/src/z16f/z16f_irq.c                       |  63 +++++------
 arch/z16/src/z16f/z16f_lowuart.S                   |  49 +++------
 arch/z16/src/z16f/z16f_restoreusercontext.S        |  45 +++-----
 arch/z16/src/z16f/z16f_saveusercontext.S           |  42 +++----
 arch/z16/src/z16f/z16f_serial.c                    | 121 ++++++++++-----------
 arch/z16/src/z16f/z16f_sysexec.c                   |   2 +-
 arch/z16/src/z16f/z16f_timerisr.c                  |  42 +++----
 boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c    |  43 +++-----
 46 files changed, 1147 insertions(+), 1687 deletions(-)
 delete mode 100644 arch/z16/src/common/up_allocateheap.c
 delete mode 100644 arch/z16/src/common/up_arch.h
 delete mode 100644 arch/z16/src/common/up_copystate.c
 delete mode 100644 arch/z16/src/common/up_doirq.c
 delete mode 100644 arch/z16/src/common/up_initialstate.c
 delete mode 100644 arch/z16/src/common/up_interruptcontext.c
 delete mode 100644 arch/z16/src/common/up_mdelay.c
 delete mode 100644 arch/z16/src/common/up_registerdump.c
 delete mode 100644 arch/z16/src/common/up_stackdump.c
 create mode 100644 arch/z16/src/common/z16_allocateheap.c
 create mode 100644 arch/z16/src/common/z16_arch.h
 rename arch/z16/src/common/{up_assert.c => z16_assert.c} (65%)
 rename arch/z16/src/common/{up_blocktask.c => z16_blocktask.c} (70%)
 create mode 100644 arch/z16/src/common/z16_copystate.c
 rename arch/z16/src/common/{up_createstack.c => z16_createstack.c} (72%)
 create mode 100644 arch/z16/src/common/z16_doirq.c
 rename arch/z16/src/common/{up_exit.c => z16_exit.c} (68%)
 rename arch/z16/src/common/{up_idle.c => z16_idle.c} (54%)
 rename arch/z16/src/common/{up_initialize.c => z16_initialize.c} (70%)
 create mode 100644 arch/z16/src/common/z16_initialstate.c
 rename arch/z16/src/common/{up_internal.h => z16_internal.h} (55%)
 create mode 100644 arch/z16/src/common/z16_interruptcontext.c
 create mode 100644 arch/z16/src/common/z16_mdelay.c
 create mode 100644 arch/z16/src/common/z16_registerdump.c
 rename arch/z16/src/common/{up_releasepending.c => z16_releasepending.c} (61%)
 rename arch/z16/src/common/{up_releasestack.c => z16_releasestack.c} (58%)
 rename arch/z16/src/common/{up_reprioritizertr.c => z16_reprioritizertr.c} (70%)
 rename arch/z16/src/common/{up_schedulesigaction.c => z16_schedulesigaction.c} (68%)
 rename arch/z16/src/common/{up_sigdeliver.c => z16_sigdeliver.c} (61%)
 create mode 100644 arch/z16/src/common/z16_stackdump.c
 rename arch/z16/src/common/{up_stackframe.c => z16_stackframe.c} (61%)
 rename arch/z16/src/common/{up_udelay.c => z16_udelay.c} (52%)
 rename arch/z16/src/common/{up_unblocktask.c => z16_unblocktask.c} (67%)
 rename arch/z16/src/common/{up_usestack.c => z16_usestack.c} (66%)


[incubator-nuttx] 02/02: Run .c and .h files in this PR through nxstyle and fix complaints

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1aa9ff8af20a66f932f2e6ffbc039f3f03617a73
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Wed Apr 29 17:49:24 2020 -0600

    Run .c and .h files in this PR through nxstyle and fix complaints
---
 arch/z16/src/common/z16_allocateheap.c          | 12 +----
 arch/z16/src/common/z16_assert.c                | 18 +++----
 arch/z16/src/common/z16_createstack.c           |  4 +-
 arch/z16/src/common/z16_doirq.c                 | 18 +++----
 arch/z16/src/common/z16_exit.c                  |  2 +-
 arch/z16/src/common/z16_initialstate.c          |  6 +--
 arch/z16/src/common/z16_internal.h              |  2 +-
 arch/z16/src/common/z16_interruptcontext.c      |  2 +-
 arch/z16/src/common/z16_mdelay.c                |  6 +--
 arch/z16/src/common/z16_registerdump.c          | 13 ++---
 arch/z16/src/common/z16_releasepending.c        |  1 -
 arch/z16/src/common/z16_reprioritizertr.c       |  7 +--
 arch/z16/src/common/z16_schedulesigaction.c     |  5 +-
 arch/z16/src/common/z16_sigdeliver.c            |  2 +-
 arch/z16/src/common/z16_stackdump.c             |  7 ++-
 arch/z16/src/common/z16_stackframe.c            | 11 +----
 arch/z16/src/common/z16_udelay.c                | 20 ++------
 arch/z16/src/z16f/chip.h                        | 36 ++++++++------
 arch/z16/src/z16f/z16f_espi.c                   | 51 ++++++++-----------
 arch/z16/src/z16f/z16f_irq.c                    | 18 ++++---
 arch/z16/src/z16f/z16f_serial.c                 | 66 ++++++++++++++-----------
 arch/z16/src/z16f/z16f_timerisr.c               | 40 +++++----------
 boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c | 41 +++++----------
 23 files changed, 172 insertions(+), 216 deletions(-)

diff --git a/arch/z16/src/common/z16_allocateheap.c b/arch/z16/src/common/z16_allocateheap.c
index d45a51e..8ecea38 100644
--- a/arch/z16/src/common/z16_allocateheap.c
+++ b/arch/z16/src/common/z16_allocateheap.c
@@ -54,14 +54,6 @@
 #endif
 
 /****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
@@ -75,7 +67,7 @@
 
 void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
 {
-  *heap_start = (FAR void*)CONFIG_HEAP1_BASE;
+  *heap_start = (FAR void *)CONFIG_HEAP1_BASE;
   *heap_size = CONFIG_HEAP1_END - CONFIG_HEAP1_BASE;
   board_autoled_on(LED_HEAPALLOCATE);
 }
@@ -92,6 +84,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
 #if CONFIG_MM_REGIONS > 1
 void z16_addregion(void)
 {
-  kmm_addregion((FAR void*)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE);
+  kmm_addregion((FAR void *)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE);
 }
 #endif
diff --git a/arch/z16/src/common/z16_assert.c b/arch/z16/src/common/z16_assert.c
index 8b52ecb..6c34075 100644
--- a/arch/z16/src/common/z16_assert.c
+++ b/arch/z16/src/common/z16_assert.c
@@ -73,19 +73,19 @@ static void _up_assert(int errorcode) /* noreturn_function */
 
   if (up_interrupt_context() || running_task()->flink == NULL)
     {
-       up_irq_save();
-        for (;;)
-          {
+      up_irq_save();
+      for (; ; )
+        {
 #if CONFIG_BOARD_RESET_ON_ASSERT >= 1
-            board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE);
+          board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE);
 #endif
 #ifdef CONFIG_ARCH_LEDS
-            board_autoled_on(LED_PANIC);
-            up_mdelay(250);
-            board_autoled_off(LED_PANIC);
-            up_mdelay(250);
+          board_autoled_on(LED_PANIC);
+          up_mdelay(250);
+          board_autoled_off(LED_PANIC);
+          up_mdelay(250);
 #endif
-          }
+        }
     }
   else
     {
diff --git a/arch/z16/src/common/z16_createstack.c b/arch/z16/src/common/z16_createstack.c
index 2517f9e..6420cb0 100644
--- a/arch/z16/src/common/z16_createstack.c
+++ b/arch/z16/src/common/z16_createstack.c
@@ -148,12 +148,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
       /* Save the adjusted stack values in the struct tcb_s */
 
-      tcb->adj_stack_ptr  = (uint32_t*)top_of_stack;
+      tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
     }
 
-   return ERROR;
+  return ERROR;
 }
diff --git a/arch/z16/src/common/z16_doirq.c b/arch/z16/src/common/z16_doirq.c
index 653f613..91f9f62 100644
--- a/arch/z16/src/common/z16_doirq.c
+++ b/arch/z16/src/common/z16_doirq.c
@@ -60,12 +60,12 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs)
       FAR chipreg_t *savestate;
 
       /* Nested interrupts are not supported in this implementation.  If
-       * you want to implement nested interrupts, you would have to (1) change
-       * the way that g_current_regs is handled and (2) the design associated
-       * with CONFIG_ARCH_INTERRUPTSTACK.  The savestate variable will not
-       * work for that purpose as implemented here because only the outermost
-       * nested interrupt can result in a context switch (it can probably be
-       * deleted).
+       * you want to implement nested interrupts, you would have to (1)
+       * change the way that g_current_regs is handled and (2) the design
+       * ssociated with CONFIG_ARCH_INTERRUPTSTACK.  The savestate variable
+       * will not work for that purpose as implemented here because only
+       * the outermost nested interrupt can result in a context switch (it
+       * can probably be deleted).
        */
 
       /* Current regs non-zero indicates that we are processing
@@ -84,9 +84,9 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs)
 
       irq_dispatch(irq, regs);
 
-      /* Restore the previous value of g_current_regs.  NULL would indicate that
-       * we are no longer in an interrupt handler.  It will be non-NULL if we
-       * are returning from a nested interrupt.
+      /* Restore the previous value of g_current_regs.  NULL would indicate
+       * that we are no longer in an interrupt handler.  It will be non-NULL
+       * if we are returning from a nested interrupt.
        */
 
       ret          = g_current_regs;
diff --git a/arch/z16/src/common/z16_exit.c b/arch/z16/src/common/z16_exit.c
index 61a4e43..17e6fe3 100644
--- a/arch/z16/src/common/z16_exit.c
+++ b/arch/z16/src/common/z16_exit.c
@@ -125,7 +125,7 @@ static void _z16_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
 
 void _exit(int status)
 {
-  FAR struct tcb_s* tcb = this_task();
+  FAR struct tcb_s *tcb = this_task();
 
   /* Make sure that we are in a critical section with local interrupts.
    * The IRQ state will be restored when the next task is started.
diff --git a/arch/z16/src/common/z16_initialstate.c b/arch/z16/src/common/z16_initialstate.c
index dd13dc1..bff0656 100644
--- a/arch/z16/src/common/z16_initialstate.c
+++ b/arch/z16/src/common/z16_initialstate.c
@@ -51,7 +51,7 @@
 
 void up_initial_state(struct tcb_s *tcb)
 {
-  uint32_t *reg32          = (uint32_t*)tcb->xcp.regs;
+  uint32_t *reg32          = (uint32_t *)tcb->xcp.regs;
 
   /* Initialize the initial exception register context structure */
 
@@ -59,6 +59,6 @@ void up_initial_state(struct tcb_s *tcb)
 #ifndef CONFIG_SUPPRESS_INTERRUPTS
   tcb->xcp.regs[REG_FLAGS] = (uint16_t)Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */
 #endif
-  reg32[REG_SP/2]          = (uint32_t)tcb->adj_stack_ptr;
-  reg32[REG_PC/2]          = (uint32_t)tcb->start;
+  reg32[REG_SP / 2]        = (uint32_t)tcb->adj_stack_ptr;
+  reg32[REG_PC / 2]        = (uint32_t)tcb->start;
 }
diff --git a/arch/z16/src/common/z16_internal.h b/arch/z16/src/common/z16_internal.h
index 7165bf0..103e034 100644
--- a/arch/z16/src/common/z16_internal.h
+++ b/arch/z16/src/common/z16_internal.h
@@ -101,7 +101,7 @@ extern volatile FAR chipreg_t *g_current_regs;
 #endif
 
 /****************************************************************************
- * Public Functions
+ * Public Function Prototypes
  ****************************************************************************/
 
 #ifndef __ASSEMBLY__
diff --git a/arch/z16/src/common/z16_interruptcontext.c b/arch/z16/src/common/z16_interruptcontext.c
index 5cd3a3e..7965f10 100644
--- a/arch/z16/src/common/z16_interruptcontext.c
+++ b/arch/z16/src/common/z16_interruptcontext.c
@@ -44,5 +44,5 @@
 
 bool up_interrupt_context(void)
 {
-   return g_current_regs != NULL;
+  return g_current_regs != NULL;
 }
diff --git a/arch/z16/src/common/z16_mdelay.c b/arch/z16/src/common/z16_mdelay.c
index 9cb2088..1d0555c 100644
--- a/arch/z16/src/common/z16_mdelay.c
+++ b/arch/z16/src/common/z16_mdelay.c
@@ -50,9 +50,9 @@ void up_mdelay(unsigned int milliseconds)
 
   for (i = 0; i < milliseconds; i++)
     {
-        for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
-          {
-          }
+      for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
+        {
+        }
     }
 }
 #endif /* CONFIG_BOARD_LOOPSPERMSEC */
diff --git a/arch/z16/src/common/z16_registerdump.c b/arch/z16/src/common/z16_registerdump.c
index 2b57ed9..2eab1fb 100644
--- a/arch/z16/src/common/z16_registerdump.c
+++ b/arch/z16/src/common/z16_registerdump.c
@@ -51,7 +51,7 @@ static chipreg_t s_last_regs[XCPTCONTEXT_REGS];
 static void z16_registerdump(void)
 {
 #ifdef CONFIG_DEBUG_INFO
-  FAR uint32_t *regs32 = (FAR uint32_t*)g_current_regs;
+  FAR uint32_t *regs32 = (FAR uint32_t *)g_current_regs;
 
   if (regs32 == NULL)
     {
@@ -61,13 +61,14 @@ static void z16_registerdump(void)
 
   _alert("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
         "R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
-        regs32[REG_R0/2],  regs32[REG_R1/2], regs32[REG_R2/2], regs32[REG_R3/2],
-        regs32[REG_R4/2],  regs32[REG_R5/2], regs32[REG_R6/2], regs32[REG_R7/2]);
+        regs32[REG_R0 / 2],  regs32[REG_R1 / 2],  regs32[REG_R2 / 2],
+        regs32[REG_R3 / 2],  regs32[REG_R4 / 2],  regs32[REG_R5 / 2],
+        regs32[REG_R6 / 2],  regs32[REG_R7 / 2]);
   _alert("R8 :%08x R9 :%08x R10:%08x R11:%08x R12:%08x R13:%08x\n"
-        regs32[REG_R8/2],  regs32[REG_R9/2], regs32[REG_R10/2], regs3[REG_R11/2],
-        regs32[REG_R12/2], regs32[REG_R13/2]);
+        regs32[REG_R8 / 2],  regs32[REG_R9 / 2],  regs32[REG_R10 / 2],
+        regs3[REG_R11 / 2],  regs32[REG_R12 / 2], regs32[REG_R13 / 2]);
   _alert("FP :%08x SP :%08x FLG:%04x\n"
-        regs32[REG_R14/2], regs32[REG_R15/2], regs32[REG_FLAGS]);
+        regs32[REG_R14 / 2], regs32[REG_R15 / 2], regs32[REG_FLAGS]);
 #endif
 }
 
diff --git a/arch/z16/src/common/z16_releasepending.c b/arch/z16/src/common/z16_releasepending.c
index 4c1c817..0ebe5c7 100644
--- a/arch/z16/src/common/z16_releasepending.c
+++ b/arch/z16/src/common/z16_releasepending.c
@@ -57,7 +57,6 @@ void up_release_pending(void)
 
   /* Merge the g_pendingtasks list into the ready-to-run task list */
 
-  /* sched_lock(); */
   if (sched_mergepending())
     {
       /* The currently active task has changed!  We will need to switch
diff --git a/arch/z16/src/common/z16_reprioritizertr.c b/arch/z16/src/common/z16_reprioritizertr.c
index 1d76870..62fe266 100644
--- a/arch/z16/src/common/z16_reprioritizertr.c
+++ b/arch/z16/src/common/z16_reprioritizertr.c
@@ -149,9 +149,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
                SET_IRQCONTEXT(rtcb);
             }
 
-          /* Copy the exception context into the TCB at the (old) head of the
-           * ready-to-run Task list. if SAVE_USERCONTEXT returns a non-zero
-           * value, then this is really the previously running task restarting!
+          /* Copy the exception context into the TCB at the (old) head of
+           * the ready-to-run Task list. if SAVE_USERCONTEXT returns a non-
+           * zero value, then this is really the previously running task
+           * restarting!
            */
 
           else if (!SAVE_USERCONTEXT(rtcb))
diff --git a/arch/z16/src/common/z16_schedulesigaction.c b/arch/z16/src/common/z16_schedulesigaction.c
index cf0cb61..c91cdd1 100644
--- a/arch/z16/src/common/z16_schedulesigaction.c
+++ b/arch/z16/src/common/z16_schedulesigaction.c
@@ -112,7 +112,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
 
           else
             {
-              FAR uint32_t *current_pc  = (FAR uint32_t*)&g_current_regs[REG_PC];
+              FAR uint32_t *current_pc  =
+                (FAR uint32_t *)&g_current_regs[REG_PC];
 
               /* Save the return address and interrupt state. These will be
                * restored by the signal trampoline after the signals have
@@ -145,7 +146,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
 
       else
         {
-          FAR uint32_t *saved_pc   = (FAR uint32_t*)&tcb->xcp.regs[REG_PC];
+          FAR uint32_t *saved_pc   = (FAR uint32_t *)&tcb->xcp.regs[REG_PC];
 
           /* Save the return lr and cpsr and one scratch register
            * These will be restored by the signal trampoline after
diff --git a/arch/z16/src/common/z16_sigdeliver.c b/arch/z16/src/common/z16_sigdeliver.c
index d562ec1..4ca8254 100644
--- a/arch/z16/src/common/z16_sigdeliver.c
+++ b/arch/z16/src/common/z16_sigdeliver.c
@@ -54,7 +54,7 @@ void z16_sigdeliver(void)
 {
   FAR struct tcb_s *rtcb = this_task();
   chipreg_t regs[XCPTCONTEXT_REGS];
-  FAR uint32_t *regs32 = (FAR uint32_t*)regs;
+  FAR uint32_t *regs32 = (FAR uint32_t *)regs;
 
   /* Save the errno.  This must be preserved throughout the signal handling
    * so that the user code final gets the correct errno value (probably
diff --git a/arch/z16/src/common/z16_stackdump.c b/arch/z16/src/common/z16_stackdump.c
index 7342614..73648d0 100644
--- a/arch/z16/src/common/z16_stackdump.c
+++ b/arch/z16/src/common/z16_stackdump.c
@@ -39,6 +39,7 @@
 /****************************************************************************
  * Name: z16_getsp
  ****************************************************************************/
+
 /* To be provided */
 
 /****************************************************************************
@@ -67,9 +68,11 @@ static void z16_stackdump(void)
       stack = sp;
     }
 
-  for (stack = stack & ~0x0f; stack < stack_base; stack += 8*sizeof(chipreg_t))
+  for (stack = stack & ~0x0f;
+       stack < stack_base;
+       stack += 8 * sizeof(chipreg_t))
     {
-      chipreg_t *ptr = (chipreg_t*)stack;
+      chipreg_t *ptr = (chipreg_t *)stack;
       _alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
             stack, ptr[0], ptr[1], ptr[2], ptr[3],
             ptr[4], ptr[5], ptr[6], ptr[7]);
diff --git a/arch/z16/src/common/z16_stackframe.c b/arch/z16/src/common/z16_stackframe.c
index 2c79a28..0b6a20e 100644
--- a/arch/z16/src/common/z16_stackframe.c
+++ b/arch/z16/src/common/z16_stackframe.c
@@ -37,6 +37,7 @@
 /****************************************************************************
  * Pre-processor Macros
  ****************************************************************************/
+
 /* Align the stack to word (4 byte) boundaries.  This is probablya greater
  * alignment than is required.
  */
@@ -50,14 +51,6 @@
 #define STACK_ALIGN_UP(a)   (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
 
 /****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
@@ -116,7 +109,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
 
   /* Reset the initial stack pointer */
 
-  tcb->xcp.regs[REG_SP/2] = (uint32_t)tcb->adj_stack_ptr;
+  tcb->xcp.regs[REG_SP / 2] = (uint32_t)tcb->adj_stack_ptr;
 
   /* And return a pointer to the allocated memory */
 
diff --git a/arch/z16/src/common/z16_udelay.c b/arch/z16/src/common/z16_udelay.c
index 5df4a0a..02e078a 100644
--- a/arch/z16/src/common/z16_udelay.c
+++ b/arch/z16/src/common/z16_udelay.c
@@ -37,22 +37,6 @@
 #define CONFIG_BOARD_LOOPSPERUSEC    ((CONFIG_BOARD_LOOPSPERMSEC+500)/1000)
 
 /****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
@@ -87,6 +71,7 @@ void up_udelay(useconds_t microseconds)
       for (i = 0; i < CONFIG_BOARD_LOOPSPERMSEC; i++)
         {
         }
+
       microseconds -= 1000;
     }
 
@@ -95,6 +80,7 @@ void up_udelay(useconds_t microseconds)
       for (i = 0; i < CONFIG_BOARD_LOOPSPER100USEC; i++)
         {
         }
+
       microseconds -= 100;
     }
 
@@ -103,6 +89,7 @@ void up_udelay(useconds_t microseconds)
       for (i = 0; i < CONFIG_BOARD_LOOPSPER10USEC; i++)
         {
         }
+
       microseconds -= 10;
     }
 
@@ -111,6 +98,7 @@ void up_udelay(useconds_t microseconds)
       for (i = 0; i < CONFIG_BOARD_LOOPSPERUSEC; i++)
         {
         }
+
       microseconds--;
     }
 }
diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h
index 050f563..64a1794 100644
--- a/arch/z16/src/z16f/chip.h
+++ b/arch/z16/src/z16f/chip.h
@@ -78,7 +78,7 @@
 # error "Z16F chip variant not specified"
 #endif
 
-/* Flash option settings at address 0x00000000 ************************************/
+/* Flash option settings at address 0x00000000 **************************************/
 
 #define Z16F_FLOPTION0            rom char _flash_option0 _At 0x0
 #define Z16F_FLOPTION1            rom char _flash_option1 _At 0x1
@@ -108,7 +108,7 @@
 #define Z16F_FLOPTION3_NORMAL     _HX8(40)        /* Bit 6: 1:Normal 0:Low power mode */
 #define Z16F_FLOPTION3_RESVD      _HX8(3f)        /* Bits 0-5: Reserved */
 
-/* Memory areas *******************************************************************
+/* Memory areas *********************************************************************
  *
  * Internal non-volatile memory starts at address zero.  The size
  * of the internal non-volatile memory is chip-dependent.
@@ -162,8 +162,14 @@
 
 /* CPU control register bits ********************************************************/
 
-                                                  /* Bits 7-2: Reserved, must be zero */
-                                                  /* Bits 1-0: DMA bandwidth control */
+                                                  /* Bits 7-2: Reserved, must be
+                                                   * zero
+                                                   */
+
+                                                  /* Bits 1-0: DMA bandwidth
+                                                   *   control
+                                                   */
+
 #define Z16F_CNTRL_CPUCTL_BWALL   _HX8(00)        /*   DMA can consume 100% bandwidth */
 #define Z16F_CNTRL_CPUCTL_BW11    _HX8(01)        /*   DMA can do 1 transaction per 1 cycle */
 #define Z16F_CNTRL_CPUCTL_BW12    _HX8(01)        /*   DMA can do 1 transaction per 2 cycles */
@@ -363,7 +369,7 @@
 # define Z16F_GPIOK_SMRE          _HX32(ffffe198) /*  8-bits: Port K Stop Mode Recovery En */
 #endif
 
-/* UART Register Offsets *************************************************************/
+/* UART Register Offsets ************************************************************/
 
 #define Z16F_UART_TXD             _HX8(00)        /*  8-bits: UART Transmit Data */
 #define Z16F_UART_RXD             _HX8(00)        /*  8-bits: UART Receive Data */
@@ -471,9 +477,9 @@
 #define Z16F_ESPI_CTL_ESPIEN1     _HX8(40)        /* Bit 6: ESPI Enable and Direction Control */
 #define Z16F_ESPI_CTL_DIRQE       _HX8(80)        /* Bit 7: Data Interrupt Request Enable */
 
-#define Z16F_ESPI_MODE_SSPO       _HX8(01)        /* Bit 0: Slave Select Polarity */
-#define Z16F_ESPI_MODE_SSIO       _HX8(02)        /* Bit 1: Slave Select I/O */
-#define Z16F_ESPI_MODE_NUMBITS_SHIFT   (2)       /* Bits 2-4: Number of Data Bits Per Character */
+#define Z16F_ESPI_MODE_SSPO       _HX8(01)                                 /* Bit 0: Slave Select Polarity */
+#define Z16F_ESPI_MODE_SSIO       _HX8(02)                                 /* Bit 1: Slave Select I/O */
+#define Z16F_ESPI_MODE_NUMBITS_SHIFT   (2)                                 /* Bits 2-4: Number of Data Bits Per Character */
 #define Z16F_ESPI_MODE_NUMBITS_MASK    (7 << Z16F_ESPI_MODE_NUMBITS_SHIFT)
 #  define Z16F_ESPI_MODE_NUMBITS_8BITS (0 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 8 bits */
 #  define Z16F_ESPI_MODE_NUMBITS_1BIT  (1 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 1 bit */
@@ -483,11 +489,11 @@
 #  define Z16F_ESPI_MODE_NUMBITS_5BITS (5 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 5 bits */
 #  define Z16F_ESPI_MODE_NUMBITS_6BITS (6 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 6 bits */
 #  define Z16F_ESPI_MODE_NUMBITS_7BITS (7 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 7 bits */
-#define Z16F_ESPI_MODE_SSMD_SHIFT      (5)       /* Bits 5-7: SLAVE SELECT Mode */
+#define Z16F_ESPI_MODE_SSMD_SHIFT      (5)                                 /* Bits 5-7: SLAVE SELECT Mode */
 #define Z16F_ESPI_MODE_SSMD_MASK       (7 << Z16F_ESPI_MODE_SSMD_SHIFT)
-#  define Z16F_ESPI_MODE_SSMD_SPI      (0 << Z16F_ESPI_MODE_SSMD_SHIFT) /* SPI mode */
-#  define Z16F_ESPI_MODE_SSMD_LPBK     (1 << Z16F_ESPI_MODE_SSMD_SHIFT) /* LOOPBACK Mode */
-#  define Z16F_ESPI_MODE_SSMD_I2S      (2 << Z16F_ESPI_MODE_SSMD_SHIFT) /* I2S Mode */
+#  define Z16F_ESPI_MODE_SSMD_SPI      (0 << Z16F_ESPI_MODE_SSMD_SHIFT)    /* SPI mode */
+#  define Z16F_ESPI_MODE_SSMD_LPBK     (1 << Z16F_ESPI_MODE_SSMD_SHIFT)    /* LOOPBACK Mode */
+#  define Z16F_ESPI_MODE_SSMD_I2S      (2 << Z16F_ESPI_MODE_SSMD_SHIFT)    /* I2S Mode */
 
 #define Z16F_ESPI_STAT_SLAS       _HX8(01)        /* Bit 0: Slave Select */
 #define Z16F_ESPI_STAT_TFST       _HX8(02)        /* Bit 1: Transfer Status */
@@ -498,7 +504,7 @@
 #define Z16F_ESPI_STAT_TUND       _HX8(40)        /* Bit 6: Transmit Underrun */
 #define Z16F_ESPI_STAT_TDRE       _HX8(80)        /* Bit 7: Transmit Data Register Empty */
 
-#define Z16F_ESPI_STATE_SHIFT     (0)             /* Bits 0-5: ESPI State Machine */
+#define Z16F_ESPI_STATE_SHIFT     (0)                             /* Bits 0-5: ESPI State Machine */
 #define Z16F_ESPI_STATE_MASK      (0x3f << Z16F_ESPI_STATE_SHIFT)
 #  define Z16F_ESPI_STATE_IDLE    (0x00 << Z16F_ESPI_STATE_SHIFT) /* Idle */
 #  define Z16F_ESPI_STATE_SWAIT   (0x01 << Z16F_ESPI_STATE_SHIFT) /* Slave Wait For SCK */
@@ -523,8 +529,8 @@
 #  define Z16F_ESPI_STATE_B1XMT   (0x23 << Z16F_ESPI_STATE_SHIFT) /* Bit 1 Transmit */
 #  define Z16F_ESPI_STATE_B0RCV   (0x20 << Z16F_ESPI_STATE_SHIFT) /* Bit 0 Receive */
 #  define Z16F_ESPI_STATE_B0XMT   (0x21 << Z16F_ESPI_STATE_SHIFT) /* Bit 0 Transmit */
-#define Z16F_ESPI_STATE_SDI       _HX8(40)        /* Bit 6: Serial Data Input */
-#define Z16F_ESPI_STATE_SCKI      _HX8(80)        /* Bit 7: Serial Clock Input */
+#define Z16F_ESPI_STATE_SDI       _HX8(40)                        /* Bit 6: Serial Data Input */
+#define Z16F_ESPI_STATE_SCKI      _HX8(80)                        /* Bit 7: Serial Clock Input */
 
 /* Timer0/1/2 registers *************************************************************/
 
diff --git a/arch/z16/src/z16f/z16f_espi.c b/arch/z16/src/z16f/z16f_espi.c
index 3372cc1..4415c4b 100644
--- a/arch/z16/src/z16f/z16f_espi.c
+++ b/arch/z16/src/z16f/z16f_espi.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * arch/z16/src/z16f/z16f_espi.c
  *
- *   Copyright (C) 2014, 2016-2017 Gregory Nutt. All rights reserved.
- *   Authors: Gregory Nutt <gn...@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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -409,7 +394,9 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
 
   spiinfo("frequency=%d\n", frequency);
 
-  /* Check if the requested frequency is the same as the frequency selection */
+  /* Check if the requested frequency is the same as the frequency
+   * selection.
+   */
 
   if (priv->frequency == frequency)
     {
@@ -561,7 +548,9 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
       spi_putreg8(priv, regval, Z16F_ESPI_MODE);
       spiinfo("ESPI MODE: %02x\n", regval);
 
-      /* Save the selection so the subsequence re-configurations will be faster */
+      /* Save the selection so the subsequence re-configurations will be
+       * faster.
+       */
 
       priv->nbits = nbits;
     }
diff --git a/arch/z16/src/z16f/z16f_irq.c b/arch/z16/src/z16f/z16f_irq.c
index f41da64..2266adc 100644
--- a/arch/z16/src/z16f/z16f_irq.c
+++ b/arch/z16/src/z16f/z16f_irq.c
@@ -84,15 +84,18 @@ void up_disable_irq(int irq)
 
       if (irq < Z16F_IRQ_IRQ1)
         {
-           putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH);
+           putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_IRQ0_BIT(irq)),
+                   Z16F_IRQ0_ENH);
         }
       else if (irq < Z16F_IRQ_IRQ2)
         {
-           putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH);
+           putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16F_IRQ1_BIT(irq)),
+                   Z16F_IRQ1_ENH);
         }
       else if (irq < NR_IRQS)
         {
-           putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH);
+           putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)),
+                   Z16F_IRQ2_ENH);
         }
     }
 }
@@ -119,15 +122,18 @@ void up_enable_irq(int irq)
 
       if (irq < Z16F_IRQ_IRQ1)
         {
-           putreg8((getreg8(Z16F_IRQ0_ENH) | Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH);
+           putreg8((getreg8(Z16F_IRQ0_ENH) | Z16F_IRQ0_BIT(irq)),
+                   Z16F_IRQ0_ENH);
         }
       else if (irq < Z16F_IRQ_IRQ2)
         {
-           putreg8((getreg8(Z16F_IRQ1_ENH) | Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH);
+           putreg8((getreg8(Z16F_IRQ1_ENH) | Z16F_IRQ1_BIT(irq)),
+                   Z16F_IRQ1_ENH);
         }
       else if (irq < NR_IRQS)
         {
-           putreg8((getreg8(Z16F_IRQ2_ENH) | Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH);
+           putreg8((getreg8(Z16F_IRQ2_ENH) | Z16F_IRQ2_BIT(irq)),
+                   Z16F_IRQ2_ENH);
         }
     }
 }
diff --git a/arch/z16/src/z16f/z16f_serial.c b/arch/z16/src/z16f/z16f_serial.c
index a0c5535..d3264dd 100644
--- a/arch/z16/src/z16f/z16f_serial.c
+++ b/arch/z16/src/z16f/z16f_serial.c
@@ -269,10 +269,12 @@ static uart_dev_t g_uart1port =
 
 static uint8_t z16f_disableuartirq(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv  = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv  = (struct z16f_uart_s *)dev->priv;
   irqstate_t          flags = enter_critical_section();
-  uint8_t             state = priv->rxenabled ? STATE_RXENABLED : STATE_DISABLED | \
-                              priv->txenabled ? STATE_TXENABLED : STATE_DISABLED;
+  uint8_t             state = priv->rxenabled ? STATE_RXENABLED :
+                                                STATE_DISABLED |
+                              priv->txenabled ? STATE_TXENABLED :
+                                                STATE_DISABLED;
 
   z16f_txint(dev, false);
   z16f_rxint(dev, false);
@@ -302,7 +304,7 @@ static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state)
 #ifdef CONSOLE_DEV
 static void z16f_consoleput(uint8_t ch)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)CONSOLE_DEV.priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)CONSOLE_DEV.priv;
   int tmp;
 
   for (tmp = 1000 ; tmp > 0 ; tmp--)
@@ -329,7 +331,7 @@ static void z16f_consoleput(uint8_t ch)
 static int z16f_setup(struct uart_dev_s *dev)
 {
 #ifndef CONFIG_SUPPRESS_UART_CONFIG
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
   uint32_t brg;
   uint8_t ctl0;
   uint8_t ctl1;
@@ -355,7 +357,7 @@ static int z16f_setup(struct uart_dev_s *dev)
 
   if (priv->parity == 1)
     {
-      ctl0 |= (Z16F_UARTCTL0_PEN|Z16F_UARTCTL0_PSEL);
+      ctl0 |= (Z16F_UARTCTL0_PEN | Z16F_UARTCTL0_PSEL);
     }
   else if (priv->parity == 2)
     {
@@ -367,7 +369,7 @@ static int z16f_setup(struct uart_dev_s *dev)
 
   /* Enable UART receive (REN) and transmit (TEN) */
 
-  ctl0 |= (Z16F_UARTCTL0_TEN|Z16F_UARTCTL0_REN);
+  ctl0 |= (Z16F_UARTCTL0_TEN | Z16F_UARTCTL0_REN);
   putreg8(ctl0, priv->uartbase + Z16F_UART_CTL0);
 #endif
 
@@ -391,20 +393,21 @@ static void z16f_shutdown(struct uart_dev_s *dev)
  * Name: z16f_attach
  *
  * Description:
- *   Configure the UART to operation in interrupt driven mode.  This method is
- *   called when the serial port is opened.  Normally, this is just after the
- *   the setup() method is called, however, the serial console may operate in
- *   a non-interrupt driven mode during the boot phase.
+ *   Configure the UART to operation in interrupt driven mode.  This method
+ *   is called when the serial port is opened.  Normally, this is just after
+ *   the the setup() method is called, however, the serial console may
+ *   operate in a non-interrupt driven mode during the boot phase.
  *
- *   RX and TX interrupts are not enabled when by the attach method (unless the
- *   hardware supports multiple levels of interrupt enabling).  The RX and TX
- *   interrupts are not enabled until the txint() and rxint() methods are called.
+ *   RX and TX interrupts are not enabled when by the attach method (unless
+ *   the hardware supports multiple levels of interrupt enabling).  The RX
+ *   and TX interrupts are not enabled until the txint() and rxint() methods
+ *   are called.
  *
  ****************************************************************************/
 
 static int z16f_attach(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
   int ret;
 
   /* Attach the RX IRQ */
@@ -429,14 +432,14 @@ static int z16f_attach(struct uart_dev_s *dev)
  *
  * Description:
  *   Detach UART interrupts.  This method is called when the serial port is
- *   closed normally just before the shutdown method is called.  The exception is
- *   the serial console which is never shutdown.
+ *   closed normally just before the shutdown method is called.  The
+ *   exception is the serial console which is never shutdown.
  *
  ****************************************************************************/
 
 static void z16f_detach(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
 
   up_disable_irq(priv->rxirq);
   up_disable_irq(priv->txirq);
@@ -461,7 +464,7 @@ static int z16f_rxinterrupt(int irq, void *context, void *arg)
   uint8_t            status;
 
   DEBUGASSERT(dev != NULL && dev->priv != NULL);
-  priv = (struct z16f_uart_s*)dev->priv;
+  priv = (struct z16f_uart_s *)dev->priv;
 
   /* Check the LIN-UART status 0 register to determine whether the source of
    * the interrupt is error, break, or received data
@@ -499,7 +502,7 @@ static int z16f_txinterrupt(int irq, void *context, FAR void *arg)
   uint8_t            status;
 
   DEBUGASSERT(dev != NULL && dev->priv != NULL);
-  priv = (struct z16f_uart_s*)dev->priv;
+  priv = (struct z16f_uart_s *)dev->priv;
 
   /* Verify that the transmit data register is empty */
 
@@ -540,7 +543,7 @@ static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg)
 
 static int z16f_receive(struct uart_dev_s *dev, uint32_t *status)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
   uint8_t rxd;
   uint8_t stat0;
 
@@ -561,7 +564,7 @@ static int z16f_receive(struct uart_dev_s *dev, uint32_t *status)
 
 static void z16f_rxint(struct uart_dev_s *dev, bool enable)
 {
-  struct z16f_uart_s *priv  = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv  = (struct z16f_uart_s *)dev->priv;
   irqstate_t          flags = enter_critical_section();
 
   if (enable)
@@ -589,8 +592,9 @@ static void z16f_rxint(struct uart_dev_s *dev, bool enable)
 
 static bool z16f_rxavailable(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
-  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_RDA) != 0);
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
+  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) &
+          Z16F_UARTSTAT0_RDA) != 0);
 }
 
 /****************************************************************************
@@ -603,7 +607,7 @@ static bool z16f_rxavailable(struct uart_dev_s *dev)
 
 static void z16f_send(struct uart_dev_s *dev, int ch)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
   putreg8(ch, priv->uartbase + Z16F_UART_TXD);
 }
 
@@ -617,7 +621,7 @@ static void z16f_send(struct uart_dev_s *dev, int ch)
 
 static void z16f_txint(struct uart_dev_s *dev, bool enable)
 {
-  struct z16f_uart_s *priv  = (struct z16f_uart_s*)dev->priv;
+  struct z16f_uart_s *priv  = (struct z16f_uart_s *)dev->priv;
   irqstate_t          flags = enter_critical_section();
 
   if (enable)
@@ -651,8 +655,9 @@ static void z16f_txint(struct uart_dev_s *dev, bool enable)
 
 static bool z16f_txready(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
-  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_TDRE) != 0);
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
+  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) &
+           Z16F_UARTSTAT0_TDRE) != 0);
 }
 
 /****************************************************************************
@@ -665,8 +670,9 @@ static bool z16f_txready(struct uart_dev_s *dev)
 
 static bool z16f_txempty(struct uart_dev_s *dev)
 {
-  struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
-  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_TXE) != 0);
+  struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv;
+  return ((getreg8(priv->uartbase + Z16F_UART_STAT0) &
+          Z16F_UARTSTAT0_TXE) != 0);
 }
 
 /****************************************************************************
diff --git a/arch/z16/src/z16f/z16f_timerisr.c b/arch/z16/src/z16f/z16f_timerisr.c
index 748ec0d..b5204f2 100644
--- a/arch/z16/src/z16f/z16f_timerisr.c
+++ b/arch/z16/src/z16f/z16f_timerisr.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * arch/z16/src/z16f/z16f_timerisr.c
  *
- *   Copyright (C) 2008-2009, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -52,6 +37,7 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* The desired timer interrupt frequency is provided by the definition
  * CLOCKS_PER_SEC (see include/time.h).  CLOCKS_PER_SEC defines the desired
  * number of system clock ticks per second.  That value is a user
diff --git a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
index f7a99a2..8082348 100644
--- a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
+++ b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * boards/z16/z16f/z16f2800100zcog/z16f_leds.c
  *
- *   Copyright (C) 2008, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -101,7 +86,7 @@ void board_autoled_off(int led)
 {
   if (led >= 1)
     {
-      board_autoled_on(led-1);
+      board_autoled_on(led - 1);
     }
 }
 #endif /* CONFIG_ARCH_LEDS */


[incubator-nuttx] 01/02: arch/z16: Correct file naming for coding standard

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f23a756349aef822be0393d02c0a7b0edf0cdd6c
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Wed Apr 29 16:31:24 2020 -0600

    arch/z16:  Correct file naming for coding standard
    
    Rename all up_* files to conform to the name conventions of https://cwiki.apache.org/confluence/display/NUTTX/Naming+FAQ
    
    Rename all internal functions from up_* z16_
---
 arch/z16/src/common/up_arch.h                      | 52 ------------
 arch/z16/src/common/up_copystate.c                 | 63 ---------------
 arch/z16/src/common/up_initialstate.c              | 79 ------------------
 arch/z16/src/common/up_interruptcontext.c          | 63 ---------------
 arch/z16/src/common/up_mdelay.c                    | 73 -----------------
 .../{up_allocateheap.c => z16_allocateheap.c}      | 47 ++++-------
 arch/z16/src/common/z16_arch.h                     | 37 +++++++++
 arch/z16/src/common/{up_assert.c => z16_assert.c}  | 50 ++++--------
 .../src/common/{up_blocktask.c => z16_blocktask.c} | 43 ++++------
 arch/z16/src/common/z16_copystate.c                | 48 +++++++++++
 .../common/{up_createstack.c => z16_createstack.c} | 43 ++++------
 arch/z16/src/common/{up_doirq.c => z16_doirq.c}    | 49 ++++-------
 arch/z16/src/common/{up_exit.c => z16_exit.c}      | 50 ++++--------
 arch/z16/src/common/{up_idle.c => z16_idle.c}      | 43 ++++------
 .../common/{up_initialize.c => z16_initialize.c}   | 51 +++++-------
 arch/z16/src/common/z16_initialstate.c             | 64 +++++++++++++++
 .../src/common/{up_internal.h => z16_internal.h}   | 94 +++++++++-------------
 arch/z16/src/common/z16_interruptcontext.c         | 48 +++++++++++
 arch/z16/src/common/z16_mdelay.c                   | 58 +++++++++++++
 .../{up_registerdump.c => z16_registerdump.c}      | 49 ++++-------
 .../{up_releasepending.c => z16_releasepending.c}  | 43 ++++------
 .../{up_releasestack.c => z16_releasestack.c}      | 43 ++++------
 ...{up_reprioritizertr.c => z16_reprioritizertr.c} | 43 ++++------
 ...schedulesigaction.c => z16_schedulesigaction.c} | 57 +++++--------
 .../common/{up_sigdeliver.c => z16_sigdeliver.c}   | 50 ++++--------
 .../src/common/{up_stackdump.c => z16_stackdump.c} | 51 +++++-------
 .../common/{up_stackframe.c => z16_stackframe.c}   | 43 ++++------
 arch/z16/src/common/{up_udelay.c => z16_udelay.c}  | 41 +++-------
 .../common/{up_unblocktask.c => z16_unblocktask.c} | 43 ++++------
 .../src/common/{up_usestack.c => z16_usestack.c}   | 43 ++++------
 arch/z16/src/z16f/Make.defs                        | 53 +++++-------
 arch/z16/src/z16f/chip.h                           | 43 ++++------
 arch/z16/src/z16f/z16f_espi.c                      |  2 +-
 arch/z16/src/z16f/z16f_head.S                      | 51 +++++-------
 arch/z16/src/z16f/z16f_irq.c                       | 45 ++++-------
 arch/z16/src/z16f/z16f_lowuart.S                   | 49 ++++-------
 arch/z16/src/z16f/z16f_restoreusercontext.S        | 45 ++++-------
 arch/z16/src/z16f/z16f_saveusercontext.S           | 42 ++++------
 arch/z16/src/z16f/z16f_serial.c                    | 55 +++++--------
 arch/z16/src/z16f/z16f_sysexec.c                   |  2 +-
 arch/z16/src/z16f/z16f_timerisr.c                  |  2 +-
 boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c    |  2 +-
 42 files changed, 728 insertions(+), 1224 deletions(-)

diff --git a/arch/z16/src/common/up_arch.h b/arch/z16/src/common/up_arch.h
deleted file mode 100644
index fc17e64..0000000
--- a/arch/z16/src/common/up_arch.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/************************************************************************************
- * arch/z16/src/common/up_arch.h
- *
- *   Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@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_Z16_SRC_COMMON_UP_ARCH_H
-#define __ARCH_Z16_SRC_COMMON_UP_ARCH_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <arch/board/board.h>
-#include "chip.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-#endif /* __ARCH_Z16_SRC_COMMON_UP_ARCH_H */
diff --git a/arch/z16/src/common/up_copystate.c b/arch/z16/src/common/up_copystate.c
deleted file mode 100644
index 7243fe5..0000000
--- a/arch/z16/src/common/up_copystate.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
- * arch/z16/src/common/up_copystate.c
- *
- *   Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@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 <arch/irq.h>
-
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_undefinedinsn
- ****************************************************************************/
-
-/* Maybe a little faster than most memcpy's */
-
-void up_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src)
-{
-  int i;
-  for (i = 0; i < XCPTCONTEXT_REGS; i++)
-    {
-      *dest++ = *src++;
-    }
-}
diff --git a/arch/z16/src/common/up_initialstate.c b/arch/z16/src/common/up_initialstate.c
deleted file mode 100644
index d531670..0000000
--- a/arch/z16/src/common/up_initialstate.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
- * arch/z16/src/common/up_initialstate.c
- *
- *   Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <nuttx/arch.h>
-
-#include "chip.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * 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 initial architecture registers
- *   and/or  stack so that execution will begin at tcb->start
- *   on the next context switch.
- *
- ****************************************************************************/
-
-void up_initial_state(struct tcb_s *tcb)
-{
-  uint32_t *reg32          = (uint32_t*)tcb->xcp.regs;
-
-  /* Initialize the initial exception register context structure */
-
-  memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
-#ifndef CONFIG_SUPPRESS_INTERRUPTS
-  tcb->xcp.regs[REG_FLAGS] = (uint16_t)Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */
-#endif
-  reg32[REG_SP/2]          = (uint32_t)tcb->adj_stack_ptr;
-  reg32[REG_PC/2]          = (uint32_t)tcb->start;
-}
diff --git a/arch/z16/src/common/up_interruptcontext.c b/arch/z16/src/common/up_interruptcontext.c
deleted file mode 100644
index 96c9521..0000000
--- a/arch/z16/src/common/up_interruptcontext.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
- * arch/z16/src/common/up_interruptcontext.c
- *
- *   Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@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/irq.h>
-
-#include "up_internal.h"
-
-/****************************************************************************
- * Public 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_current_regs != NULL;
-}
diff --git a/arch/z16/src/common/up_mdelay.c b/arch/z16/src/common/up_mdelay.c
deleted file mode 100644
index 56243be..0000000
--- a/arch/z16/src/common/up_mdelay.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * arch/z16/src/common/up_mdelay.c
- *
- *   Copyright (C) 2008 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@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>
-
-#ifdef CONFIG_BOARD_LOOPSPERMSEC
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_mdelay
- *
- * Description:
- *   Delay inline for the requested number of milliseconds.
- *   *** NOT multi-tasking friendly ***
- *
- * ASSUMPTIONS:
- *   The setting CONFIG_BOARD_LOOPSPERMSEC has been calibrated
- *
- ****************************************************************************/
-
-void up_mdelay(unsigned int milliseconds)
-{
-  volatile int i;
-  volatile int j;
-
-  for (i = 0; i < milliseconds; i++)
-    {
-        for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
-          {
-          }
-    }
-}
-#endif /* CONFIG_BOARD_LOOPSPERMSEC */
diff --git a/arch/z16/src/common/up_allocateheap.c b/arch/z16/src/common/z16_allocateheap.c
similarity index 59%
rename from arch/z16/src/common/up_allocateheap.c
rename to arch/z16/src/common/z16_allocateheap.c
index 73a9f1c..d45a51e 100644
--- a/arch/z16/src/common/up_allocateheap.c
+++ b/arch/z16/src/common/z16_allocateheap.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_allocateheap.c
+ * arch/z16/src/common/z16_allocateheap.c
  *
- *   Copyright (C) 2008, 2013, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -48,7 +33,7 @@
 #include <arch/board/board.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -96,7 +81,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
 }
 
 /****************************************************************************
- * Name: up_addregions
+ * Name: z16_addregions
  *
  * Description:
  *   Memory may be added in non-contiguous chunks.  Additional chunks are
@@ -105,7 +90,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
  ****************************************************************************/
 
 #if CONFIG_MM_REGIONS > 1
-void up_addregion(void)
+void z16_addregion(void)
 {
   kmm_addregion((FAR void*)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE);
 }
diff --git a/arch/z16/src/common/z16_arch.h b/arch/z16/src/common/z16_arch.h
new file mode 100644
index 0000000..ec04d25
--- /dev/null
+++ b/arch/z16/src/common/z16_arch.h
@@ -0,0 +1,37 @@
+/************************************************************************************
+ * arch/z16/src/common/z16_arch.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_Z16_SRC_COMMON_Z16_ARCH_H
+#define __ARCH_Z16_SRC_COMMON_Z16_ARCH_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/board/board.h>
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#endif /* __ARCH_Z16_SRC_COMMON_Z16_ARCH_H */
diff --git a/arch/z16/src/common/up_assert.c b/arch/z16/src/common/z16_assert.c
similarity index 69%
rename from arch/z16/src/common/up_assert.c
rename to arch/z16/src/common/z16_assert.c
index beeeb4c..8b52ecb 100644
--- a/arch/z16/src/common/up_assert.c
+++ b/arch/z16/src/common/z16_assert.c
@@ -1,36 +1,20 @@
 /****************************************************************************
- * common/up_assert.c
+ * common/z16_assert.c
  *
- *   Copyright (C) 2008-2009, 2012-2016, 2018 Gregory Nutt. All rights
- *     reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -55,7 +39,7 @@
 
 #include "chip.h"
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -177,8 +161,8 @@ void up_assert(void)
 #endif
 #endif
 
-  up_registerdump();
-  up_stackdump();
+  z16_registerdump();
+  z16_stackdump();
 
 #ifdef CONFIG_ARCH_USBDUMP
   /* Dump USB trace data */
@@ -191,7 +175,7 @@ void up_assert(void)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(z16_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/z16/src/common/up_blocktask.c b/arch/z16/src/common/z16_blocktask.c
similarity index 70%
rename from arch/z16/src/common/up_blocktask.c
rename to arch/z16/src/common/z16_blocktask.c
index 390fc20..a0a6a25 100644
--- a/arch/z16/src/common/up_blocktask.c
+++ b/arch/z16/src/common/z16_blocktask.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_blocktask.c
+ * arch/z16/src/common/z16_blocktask.c
  *
- *   Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,7 +32,7 @@
 #include <nuttx/sched.h>
 
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/z16/src/common/z16_copystate.c b/arch/z16/src/common/z16_copystate.c
new file mode 100644
index 0000000..c6d2240
--- /dev/null
+++ b/arch/z16/src/common/z16_copystate.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * arch/z16/src/common/z16_copystate.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/irq.h>
+
+#include "z16_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: z16_copystate
+ ****************************************************************************/
+
+/* Maybe a little faster than most memcpy's */
+
+void z16_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src)
+{
+  int i;
+  for (i = 0; i < XCPTCONTEXT_REGS; i++)
+    {
+      *dest++ = *src++;
+    }
+}
diff --git a/arch/z16/src/common/up_createstack.c b/arch/z16/src/common/z16_createstack.c
similarity index 73%
rename from arch/z16/src/common/up_createstack.c
rename to arch/z16/src/common/z16_createstack.c
index 2e514ba..2517f9e 100644
--- a/arch/z16/src/common/up_createstack.c
+++ b/arch/z16/src/common/z16_createstack.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/common/up_createstack.c
+ * arch/z16/common/z16_createstack.c
  *
- *   Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -50,7 +35,7 @@
 #include <arch/board/board.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Private Types
diff --git a/arch/z16/src/common/up_doirq.c b/arch/z16/src/common/z16_doirq.c
similarity index 57%
rename from arch/z16/src/common/up_doirq.c
rename to arch/z16/src/common/z16_doirq.c
index 5211216..653f613 100644
--- a/arch/z16/src/common/up_doirq.c
+++ b/arch/z16/src/common/z16_doirq.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_doirq.c
+ * arch/z16/src/common/z16_doirq.c
  *
- *   Copyright (C) 2008-2009, 2011, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,14 +32,14 @@
 #include <arch/board/board.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_doirq
+ * Name: z16_doirq
  *
  * Description:
  *   Interface between low-level IRQ decode logic and the NuttX IRQ dispatch
@@ -62,7 +47,7 @@
  *
  ****************************************************************************/
 
-FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs)
+FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs)
 {
   FAR chipreg_t *ret = regs;
 
@@ -93,7 +78,7 @@ FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs)
 
       /* Acknowledge the interrupt */
 
-      up_ack_irq(irq);
+      z16_ack_irq(irq);
 
       /* Deliver the IRQ */
 
diff --git a/arch/z16/src/common/up_exit.c b/arch/z16/src/common/z16_exit.c
similarity index 68%
rename from arch/z16/src/common/up_exit.c
rename to arch/z16/src/common/z16_exit.c
index a2d1dd7..61a4e43 100644
--- a/arch/z16/src/common/up_exit.c
+++ b/arch/z16/src/common/z16_exit.c
@@ -1,36 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_exit.c
+ * arch/z16/src/common/z16_exit.c
  *
- *   Copyright (C) 2008-2009, 2013, 2017-2018 Gregory Nutt. All rights
- *     reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -52,7 +36,7 @@
 #include "chip.h"
 #include "task/task.h"
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -67,7 +51,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: _up_dumponexit
+ * Name: _z16_dumponexit
  *
  * Description:
  *   Dump the state of all tasks whenever on task exits.  This is debug
@@ -77,7 +61,7 @@
  ****************************************************************************/
 
 #ifdef CONFIG_DUMP_ON_EXIT
-static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
+static void _z16_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
 {
   FAR struct filelist *filelist;
 #if CONFIG_NFILE_STREAMS > 0
@@ -153,7 +137,7 @@ void _exit(int status)
 
 #ifdef CONFIG_DUMP_ON_EXIT
   sinfo("Other tasks:\n");
-  sched_foreach(_up_dumponexit, NULL);
+  sched_foreach(_z16_dumponexit, NULL);
 #endif
 
   /* Update scheduler parameters */
diff --git a/arch/z16/src/common/up_idle.c b/arch/z16/src/common/z16_idle.c
similarity index 54%
rename from arch/z16/src/common/up_idle.c
rename to arch/z16/src/common/z16_idle.c
index 0cca264..9e17b97 100644
--- a/arch/z16/src/common/up_idle.c
+++ b/arch/z16/src/common/z16_idle.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_idle.c
+ * arch/z16/src/common/z16_idle.c
  *
- *   Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -45,7 +30,7 @@
 #include <nuttx/board.h>
 #include <arch/board/board.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Private Data
diff --git a/arch/z16/src/common/up_initialize.c b/arch/z16/src/common/z16_initialize.c
similarity index 70%
rename from arch/z16/src/common/up_initialize.c
rename to arch/z16/src/common/z16_initialize.c
index 4ce2e09e..efff03d 100644
--- a/arch/z16/src/common/up_initialize.c
+++ b/arch/z16/src/common/z16_initialize.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_initialize.c
+ * arch/z16/src/common/z16_initialize.c
  *
- *   Copyright (C) 2008-2009, 2011-2013, 2015-2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -56,8 +41,8 @@
 
 #include <arch/board/board.h>
 
-#include "up_arch.h"
-#include "up_internal.h"
+#include "z16_arch.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Data
@@ -100,7 +85,7 @@ void up_initialize(void)
 #if CONFIG_MM_REGIONS > 1
   /* Add any extra memory fragments to the memory manager */
 
-  up_addregion();
+  z16_addregion();
 #endif
 
 #ifdef CONFIG_PM
@@ -143,7 +128,7 @@ void up_initialize(void)
   /* Initialize the serial device driver */
 
 #ifdef USE_SERIALDRIVER
-  up_serialinit();
+  z16_serialinit();
 #endif
 
 #ifdef CONFIG_RPMSG_UART
@@ -177,7 +162,7 @@ void up_initialize(void)
 #ifndef CONFIG_NETDEV_LATEINIT
   /* Initialize the network */
 
-  up_netinitialize();
+  z16_netinitialize();
 #endif
 
 #ifdef CONFIG_NET_LOOPBACK
diff --git a/arch/z16/src/common/z16_initialstate.c b/arch/z16/src/common/z16_initialstate.c
new file mode 100644
index 0000000..dd13dc1
--- /dev/null
+++ b/arch/z16/src/common/z16_initialstate.c
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * arch/z16/src/common/z16_initialstate.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <string.h>
+#include <nuttx/arch.h>
+
+#include "chip.h"
+#include "z16_internal.h"
+
+/****************************************************************************
+ * 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 initial architecture registers
+ *   and/or  stack so that execution will begin at tcb->start
+ *   on the next context switch.
+ *
+ ****************************************************************************/
+
+void up_initial_state(struct tcb_s *tcb)
+{
+  uint32_t *reg32          = (uint32_t*)tcb->xcp.regs;
+
+  /* Initialize the initial exception register context structure */
+
+  memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
+#ifndef CONFIG_SUPPRESS_INTERRUPTS
+  tcb->xcp.regs[REG_FLAGS] = (uint16_t)Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */
+#endif
+  reg32[REG_SP/2]          = (uint32_t)tcb->adj_stack_ptr;
+  reg32[REG_PC/2]          = (uint32_t)tcb->start;
+}
diff --git a/arch/z16/src/common/up_internal.h b/arch/z16/src/common/z16_internal.h
similarity index 55%
rename from arch/z16/src/common/up_internal.h
rename to arch/z16/src/common/z16_internal.h
index 0927138..7165bf0 100644
--- a/arch/z16/src/common/up_internal.h
+++ b/arch/z16/src/common/z16_internal.h
@@ -1,41 +1,25 @@
 /****************************************************************************
- * arch/z16/src/common/up_internal.h
+ * arch/z16/src/common/z16_internal.h
  *
- *   Copyright (C) 2008-2009, 2011-2013, 2015, 2-18 Gregory Nutt. All
- *     rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
-#ifndef __ARCH_Z16_SRC_COMMON_UP_INTERNAL_H
-#define __ARCH_Z16_SRC_COMMON_UP_INTERNAL_H
+#ifndef __ARCH_Z16_SRC_COMMON_Z16_INTERNAL_H
+#define __ARCH_Z16_SRC_COMMON_Z16_INTERNAL_H
 
 /****************************************************************************
  * Included Files
@@ -53,7 +37,7 @@
  * board bring-up and not part of normal platform configuration.
  */
 
-#undef  CONFIG_Z16_LOWPUTC            /* Support up_lowputc for debug */
+#undef  CONFIG_Z16_LOWPUTC            /* Support z16_lowputc for debug */
 #undef  CONFIG_Z16_LOWGETC            /* support z16_lowgetc for debug */
 
 /* Determine which (if any) console driver to use.  If a console is enabled
@@ -89,11 +73,11 @@
 /* Macros for portability */
 
 #define IN_INTERRUPT             (g_current_regs != NULL)
-#define SAVE_IRQCONTEXT(tcb)     up_copystate((tcb)->xcp.regs, (FAR chipreg_t*)g_current_regs)
+#define SAVE_IRQCONTEXT(tcb)     z16_copystate((tcb)->xcp.regs, (FAR chipreg_t*)g_current_regs)
 #define SET_IRQCONTEXT(tcb)      do { g_current_regs = (tcb)->xcp.regs; } while (0)
-#define SAVE_USERCONTEXT(tcb)    up_saveusercontext((tcb)->xcp.regs)
-#define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs)
-#define SIGNAL_RETURN(regs)      up_restoreusercontext(regs)
+#define SAVE_USERCONTEXT(tcb)    z16_saveusercontext((tcb)->xcp.regs)
+#define RESTORE_USERCONTEXT(tcb) z16_restoreusercontext((tcb)->xcp.regs)
+#define SIGNAL_RETURN(regs)      z16_restoreusercontext(regs)
 
 /****************************************************************************
  * Public Types
@@ -124,32 +108,32 @@ extern volatile FAR chipreg_t *g_current_regs;
 
 /* Defined in files with the same name as the function */
 
-void up_copystate(FAR chipreg_t *dest, FAR chipreg_t *src);
-FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs);
-void up_restoreusercontext(FAR chipreg_t *regs);
-int  up_saveusercontext(FAR chipreg_t *regs);
-void up_sigdeliver(void);
+void z16_copystate(FAR chipreg_t *dest, FAR chipreg_t *src);
+FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs);
+void z16_restoreusercontext(FAR chipreg_t *regs);
+int  z16_saveusercontext(FAR chipreg_t *regs);
+void z16_sigdeliver(void);
 
 #if defined(CONFIG_Z16_LOWPUTC) || defined(CONFIG_Z16_LOWGETC)
-void up_lowputc(char ch);
+void z16_lowputc(char ch);
 #else
-# define up_lowputc(ch)
+# define z16_lowputc(ch)
 #endif
 
 /* Defined in xyz_allocateheap.c */
 
 #if CONFIG_MM_REGIONS > 1
-void up_addregion(void);
+void z16_addregion(void);
 #endif
 
 /* Defined in xyz_serial.c */
 
 #ifdef USE_SERIALDRIVER
-void up_serialinit(void);
+void z16_serialinit(void);
 #endif
 
 #ifdef USE_EARLYSERIALINIT
-void up_earlyserialinit(void);
+void z16_earlyserialinit(void);
 #endif
 
 #ifdef CONFIG_RPMSG_UART
@@ -158,30 +142,30 @@ void rpmsg_serialinit(void);
 
 /* Defined in xyz_irq.c */
 
-void up_ack_irq(int irq);
+void z16_ack_irq(int irq);
 
 /* Defined in board/xyz_network.c */
 
 #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
-void up_netinitialize(void);
+void z16_netinitialize(void);
 #else
-# define up_netinitialize()
+# define z16_netinitialize()
 #endif
 
 /* Return the current value of the stack pointer (used in stack dump logic) */
 
-chipreg_t up_getsp(void);
+chipreg_t z16_getsp(void);
 
 /* Dump stack and registers */
 
 #ifdef CONFIG_ARCH_STACKDUMP
-void up_stackdump(void);
-void up_registerdump(void);
+void z16_stackdump(void);
+void z16_registerdump(void);
 #else
-# define up_stackdump()
-# define up_registerdump()
+# define z16_stackdump()
+# define z16_registerdump()
 #endif
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ARCH_Z16_SRC_COMMON_UP_INTERNAL_H */
+#endif /* __ARCH_Z16_SRC_COMMON_Z16_INTERNAL_H */
diff --git a/arch/z16/src/common/z16_interruptcontext.c b/arch/z16/src/common/z16_interruptcontext.c
new file mode 100644
index 0000000..5cd3a3e
--- /dev/null
+++ b/arch/z16/src/common/z16_interruptcontext.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * arch/z16/src/common/z16_interruptcontext.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include "z16_internal.h"
+
+/****************************************************************************
+ * Public 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_current_regs != NULL;
+}
diff --git a/arch/z16/src/common/z16_mdelay.c b/arch/z16/src/common/z16_mdelay.c
new file mode 100644
index 0000000..9cb2088
--- /dev/null
+++ b/arch/z16/src/common/z16_mdelay.c
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * arch/z16/src/common/z16_mdelay.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/arch.h>
+
+#ifdef CONFIG_BOARD_LOOPSPERMSEC
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_mdelay
+ *
+ * Description:
+ *   Delay inline for the requested number of milliseconds.
+ *   *** NOT multi-tasking friendly ***
+ *
+ * ASSUMPTIONS:
+ *   The setting CONFIG_BOARD_LOOPSPERMSEC has been calibrated
+ *
+ ****************************************************************************/
+
+void up_mdelay(unsigned int milliseconds)
+{
+  volatile int i;
+  volatile int j;
+
+  for (i = 0; i < milliseconds; i++)
+    {
+        for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++)
+          {
+          }
+    }
+}
+#endif /* CONFIG_BOARD_LOOPSPERMSEC */
diff --git a/arch/z16/src/common/up_registerdump.c b/arch/z16/src/common/z16_registerdump.c
similarity index 50%
rename from arch/z16/src/common/up_registerdump.c
rename to arch/z16/src/common/z16_registerdump.c
index 6a6e663..2b57ed9 100644
--- a/arch/z16/src/common/up_registerdump.c
+++ b/arch/z16/src/common/z16_registerdump.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_registerdump.c
+ * arch/z16/src/common/z16_registerdump.c
  *
- *   Copyright (C) 2008-2009, 2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -45,7 +30,7 @@
 #include <nuttx/irq.h>
 #include <nuttx/arch.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 #ifdef CONFIG_ARCH_STACKDUMP
 
@@ -60,17 +45,17 @@ static chipreg_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_registerdump
+ * Name: z16_registerdump
  ****************************************************************************/
 
-static void up_registerdump(void)
+static void z16_registerdump(void)
 {
 #ifdef CONFIG_DEBUG_INFO
   FAR uint32_t *regs32 = (FAR uint32_t*)g_current_regs;
 
   if (regs32 == NULL)
     {
-      up_saveusercontext(s_last_regs);
+      z16_saveusercontext(s_last_regs);
       regs32 = (FAR uint32_t *)s_last_regs;
     }
 
diff --git a/arch/z16/src/common/up_releasepending.c b/arch/z16/src/common/z16_releasepending.c
similarity index 62%
rename from arch/z16/src/common/up_releasepending.c
rename to arch/z16/src/common/z16_releasepending.c
index 4df9fdc..4c1c817 100644
--- a/arch/z16/src/common/up_releasepending.c
+++ b/arch/z16/src/common/z16_releasepending.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_releasepending.c
+ * arch/z16/src/common/z16_releasepending.c
  *
- *   Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,7 +32,7 @@
 
 #include "chip.h"
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/z16/src/common/up_releasestack.c b/arch/z16/src/common/z16_releasestack.c
similarity index 58%
rename from arch/z16/src/common/up_releasestack.c
rename to arch/z16/src/common/z16_releasestack.c
index eb76a00..95f5e95 100644
--- a/arch/z16/src/common/up_releasestack.c
+++ b/arch/z16/src/common/z16_releasestack.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_releasestack.c
+ * arch/z16/src/common/z16_releasestack.c
  *
- *   Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -45,7 +30,7 @@
 #include <nuttx/arch.h>
 #include <nuttx/kmalloc.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Private Types
diff --git a/arch/z16/src/common/up_reprioritizertr.c b/arch/z16/src/common/z16_reprioritizertr.c
similarity index 73%
rename from arch/z16/src/common/up_reprioritizertr.c
rename to arch/z16/src/common/z16_reprioritizertr.c
index 33215d4..1d76870 100644
--- a/arch/z16/src/common/up_reprioritizertr.c
+++ b/arch/z16/src/common/z16_reprioritizertr.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_reprioritizertr.c
+ * arch/z16/src/common/z16_reprioritizertr.c
  *
- *   Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -49,7 +34,7 @@
 
 #include "chip.h"
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/z16/src/common/up_schedulesigaction.c b/arch/z16/src/common/z16_schedulesigaction.c
similarity index 69%
rename from arch/z16/src/common/up_schedulesigaction.c
rename to arch/z16/src/common/z16_schedulesigaction.c
index 54c8077..cf0cb61 100644
--- a/arch/z16/src/common/up_schedulesigaction.c
+++ b/arch/z16/src/common/z16_schedulesigaction.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_schedulesigaction.c
+ * arch/z16/src/common/z16_schedulesigaction.c
  *
- *   Copyright (C) 2008-2010, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,7 +32,7 @@
 #include <nuttx/irq.h>
 
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
@@ -134,22 +119,22 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
                * been delivered.
                */
 
-              tcb->xcp.sigdeliver     = sigdeliver;
-              tcb->xcp.saved_pc       = *current_pc;
-              tcb->xcp.saved_i        = g_current_regs[REG_FLAGS];
+              tcb->xcp.sigdeliver       = sigdeliver;
+              tcb->xcp.saved_pc         = *current_pc;
+              tcb->xcp.saved_i          = g_current_regs[REG_FLAGS];
 
               /* Then set up to vector to the trampoline with interrupts
                * disabled
                */
 
-              *current_pc             = (uint32_t)up_sigdeliver;
+              *current_pc               = (uint32_t)z16_sigdeliver;
               g_current_regs[REG_FLAGS] = 0;
 
               /* And make sure that the saved context in the TCB is the
                * same as the interrupt return context.
                */
 
-              up_copystate(tcb->xcp.regs, g_current_regs);
+              z16_copystate(tcb->xcp.regs, g_current_regs);
             }
         }
 
@@ -160,7 +145,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
 
       else
         {
-          FAR uint32_t *saved_pc     = (FAR uint32_t*)&tcb->xcp.regs[REG_PC];
+          FAR uint32_t *saved_pc   = (FAR uint32_t*)&tcb->xcp.regs[REG_PC];
 
           /* Save the return lr and cpsr and one scratch register
            * These will be restored by the signal trampoline after
@@ -175,7 +160,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
            * disabled
            */
 
-          *saved_pc                = (uint32_t)up_sigdeliver;
+          *saved_pc                = (uint32_t)z16_sigdeliver;
           tcb->xcp.regs[REG_FLAGS] = 0;
         }
     }
diff --git a/arch/z16/src/common/up_sigdeliver.c b/arch/z16/src/common/z16_sigdeliver.c
similarity index 62%
rename from arch/z16/src/common/up_sigdeliver.c
rename to arch/z16/src/common/z16_sigdeliver.c
index c654156..d562ec1 100644
--- a/arch/z16/src/common/up_sigdeliver.c
+++ b/arch/z16/src/common/z16_sigdeliver.c
@@ -1,36 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_sigdeliver.c
+ * arch/z16/src/common/z16_sigdeliver.c
  *
- *   Copyright (C) 2008-2010, 2015, 2018-2019 Gregory Nutt. All rights
- *     reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -50,14 +34,14 @@
 #include <arch/board/board.h>
 
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_sigdeliver
+ * Name: z16_sigdeliver
  *
  * Description:
  *   This is the a signal handling trampoline.  When a signal action was
@@ -66,7 +50,7 @@
  *
  ****************************************************************************/
 
-void up_sigdeliver(void)
+void z16_sigdeliver(void)
 {
   FAR struct tcb_s *rtcb = this_task();
   chipreg_t regs[XCPTCONTEXT_REGS];
@@ -87,7 +71,7 @@ void up_sigdeliver(void)
 
   /* Save the return state on the stack. */
 
-  up_copystate(regs, rtcb->xcp.regs);
+  z16_copystate(regs, rtcb->xcp.regs);
 
 #ifndef CONFIG_SUPPRESS_INTERRUPTS
   /* Then make sure that interrupts are enabled.  Signal handlers must always
diff --git a/arch/z16/src/common/up_stackdump.c b/arch/z16/src/common/z16_stackdump.c
similarity index 50%
rename from arch/z16/src/common/up_stackdump.c
rename to arch/z16/src/common/z16_stackdump.c
index 40abf37..7342614 100644
--- a/arch/z16/src/common/up_stackdump.c
+++ b/arch/z16/src/common/z16_stackdump.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_stackdump.c
+ * arch/z16/src/common/z16_stackdump.c
  *
- *   Copyright (C) 2008-2009, 2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -43,7 +28,7 @@
 
 #include "chip.h"
 #include "sched/sched.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 #ifdef CONFIG_ARCH_STACKDUMP
 
@@ -52,18 +37,18 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
+ * Name: z16_getsp
  ****************************************************************************/
 /* To be provided */
 
 /****************************************************************************
- * Name: up_stackdump
+ * Name: z16_stackdump
  ****************************************************************************/
 
-static void up_stackdump(void)
+static void z16_stackdump(void)
 {
   struct tcb_s *rtcb = this_task();
-  chipreg_t sp = up_getsp();
+  chipreg_t sp = z16_getsp();
   chipreg_t stack_base = (chipreg_t)rtcb->adj_stack_ptr;
   chipreg_t stack_size = (chipreg_t)rtcb->adj_stack_size;
   chipreg_t stack;
diff --git a/arch/z16/src/common/up_stackframe.c b/arch/z16/src/common/z16_stackframe.c
similarity index 68%
rename from arch/z16/src/common/up_stackframe.c
rename to arch/z16/src/common/z16_stackframe.c
index 6aa003b..2c79a28 100644
--- a/arch/z16/src/common/up_stackframe.c
+++ b/arch/z16/src/common/z16_stackframe.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_stackframe.c
+ * arch/z16/src/common/z16_stackframe.c
  *
- *   Copyright (C) 2013 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,7 +32,7 @@
 #include <nuttx/arch.h>
 #include <arch/irq.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Macros
diff --git a/arch/z16/src/common/up_udelay.c b/arch/z16/src/common/z16_udelay.c
similarity index 66%
rename from arch/z16/src/common/up_udelay.c
rename to arch/z16/src/common/z16_udelay.c
index a6f7809..5df4a0a 100644
--- a/arch/z16/src/common/up_udelay.c
+++ b/arch/z16/src/common/z16_udelay.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_udelay.c
+ * arch/z16/src/common/z16_udelay.c
  *
- *   Copyright (C) 2008 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
diff --git a/arch/z16/src/common/up_unblocktask.c b/arch/z16/src/common/z16_unblocktask.c
similarity index 67%
rename from arch/z16/src/common/up_unblocktask.c
rename to arch/z16/src/common/z16_unblocktask.c
index 1a92cbf..1ba8fe5 100644
--- a/arch/z16/src/common/up_unblocktask.c
+++ b/arch/z16/src/common/z16_unblocktask.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/src/common/up_unblocktask.c
+ * arch/z16/src/common/z16_unblocktask.c
  *
- *   Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -48,7 +33,7 @@
 #include "chip.h"
 #include "sched/sched.h"
 #include "clock/clock.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/z16/src/common/up_usestack.c b/arch/z16/src/common/z16_usestack.c
similarity index 66%
rename from arch/z16/src/common/up_usestack.c
rename to arch/z16/src/common/z16_usestack.c
index 6ff7c19..3971f6f 100644
--- a/arch/z16/src/common/up_usestack.c
+++ b/arch/z16/src/common/z16_usestack.c
@@ -1,35 +1,20 @@
 /****************************************************************************
- * arch/z16/common/up_usestack.c
+ * arch/z16/common/z16_usestack.c
  *
- *   Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -47,7 +32,7 @@
 #include <nuttx/kmalloc.h>
 #include <nuttx/arch.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Private Types
diff --git a/arch/z16/src/z16f/Make.defs b/arch/z16/src/z16f/Make.defs
index f14570f..25c7bb2 100644
--- a/arch/z16/src/z16f/Make.defs
+++ b/arch/z16/src/z16f/Make.defs
@@ -1,48 +1,33 @@
 ############################################################################
 # arch/z16/src/z16f/Make.defs
 #
-#   Copyright (C) 2008, 2014 Gregory Nutt. All rights reserved.
-#   Author: Gregory Nutt <gn...@nuttx.org>
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
 #
 ############################################################################
 
 HEAD_SSRC = z16f_head.S
 
 CMN_SSRCS  =
-CMN_CSRCS  = up_allocateheap.c up_initialize.c up_schedulesigaction.c
-CMN_CSRCS += up_assert.c up_initialstate.c up_sigdeliver.c up_blocktask.c
-CMN_CSRCS += up_interruptcontext.c up_stackdump.c up_copystate.c
-CMN_CSRCS += up_mdelay.c up_udelay.c up_createstack.c up_registerdump.c
-CMN_CSRCS += up_unblocktask.c up_doirq.c up_releasepending.c up_usestack.c
-CMN_CSRCS += up_exit.c up_releasestack.c up_stackframe.c up_idle.c
-CMN_CSRCS += up_reprioritizertr.c
+CMN_CSRCS  = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c
+CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c z16_blocktask.c
+CMN_CSRCS += z16_interruptcontext.c z16_stackdump.c z16_copystate.c
+CMN_CSRCS += z16_mdelay.c z16_udelay.c z16_createstack.c z16_registerdump.c
+CMN_CSRCS += z16_unblocktask.c z16_doirq.c z16_releasepending.c z16_usestack.c
+CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c
+CMN_CSRCS += z16_reprioritizertr.c
 
 CHIP_SSRCS = z16f_lowuart.S z16f_saveusercontext.S z16f_restoreusercontext.S
 CHIP_CSRCS = z16f_clkinit.c z16f_sysexec.c z16f_irq.c z16f_serial.c
diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h
index 64d05ae..050f563 100644
--- a/arch/z16/src/z16f/chip.h
+++ b/arch/z16/src/z16f/chip.h
@@ -1,35 +1,20 @@
 /************************************************************************************
  * arch/z16/src/z16f/chip.h
  *
- *   Copyright (C) 2008-2009, 2014 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ************************************************************************************/
 
@@ -51,7 +36,7 @@
 #  include <nuttx/spi/spi.h>
 #endif
 
-#include "common/up_internal.h"
+#include "common/z16_internal.h"
 
 /************************************************************************************
  * Pre-processor Definitions
@@ -654,7 +639,7 @@ extern "C"
 
 /* The following two routines are called from the low-level reset logic.
  * z16f_board_initialize() must be provided by the board-specific logic;
- * z16f_lowuartinit() is called only if debugging support for up_lowputc (or getc)
+ * z16f_lowuartinit() is called only if debugging support for z16_lowputc (or getc)
  * is enabled.
  */
 
diff --git a/arch/z16/src/z16f/z16f_espi.c b/arch/z16/src/z16f/z16f_espi.c
index 778e16c..3372cc1 100644
--- a/arch/z16/src/z16f/z16f_espi.c
+++ b/arch/z16/src/z16f/z16f_espi.c
@@ -50,7 +50,7 @@
 #include <nuttx/semaphore.h>
 #include <nuttx/spi/spi.h>
 
-#include "up_arch.h"
+#include "z16_arch.h"
 #include "chip.h"
 
 #ifdef CONFIG_Z16F_ESPI
diff --git a/arch/z16/src/z16f/z16f_head.S b/arch/z16/src/z16f/z16f_head.S
index 9c633f8..f43d240 100644
--- a/arch/z16/src/z16f/z16f_head.S
+++ b/arch/z16/src/z16f/z16f_head.S
@@ -2,35 +2,20 @@
  * arch/z16/src/z16f/z16f_head.S
  * Z16F Reset Entry Point
  *
- *   Copyright (C) 2008, 2012 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  **************************************************************************/
 
@@ -41,7 +26,7 @@
 #include <nuttx/config.h>
 #include <arch/irq.h>
 #include <arch/board/board.h>
-#include "common/up_internal.h"
+#include "common/z16_internal.h"
 
 /**************************************************************************
  * Pre-processor Definitions
@@ -59,10 +44,10 @@
 #if defined(USE_LOWUARTINIT)
 	xref	_z16f_lowuartinit:EROM
 #elif defined(USE_EARLYSERIALINIT)
-	xref	_up_earlyserialinit:EROM
+	xref	_z16_earlyserialinit:EROM
 #endif
 	xref	_nx_start:EROM
-	xref	_up_doirq:EROM
+	xref	_z16_doirq:EROM
 	xref	_z16f_sysexec:EROM
 	xdef	_z16f_reset
 
@@ -218,7 +203,7 @@ _z16f_reset8:
 #ifdef USE_EARLYSERIALINIT
 	/* Perform early serial initialization */
 
-	call	_up_earlyserialinit
+	call	_z16_earlyserialinit
 #endif
 	/* Start NuttX */
 
@@ -450,9 +435,9 @@ _common_isr:
 	 */
 
 	ld		r2, sp
-	call	_up_doirq
+	call	_z16_doirq
 
-	/* Upon return, _up_doirq will provide that address of the save structure
+	/* Upon return, _z16_doirq will provide that address of the save structure
 	 * to use to return from the interrupt in r0.  This may or may not be the
 	 * same value as sp.
 	 */
diff --git a/arch/z16/src/z16f/z16f_irq.c b/arch/z16/src/z16f/z16f_irq.c
index 4c9b71a..f41da64 100644
--- a/arch/z16/src/z16f/z16f_irq.c
+++ b/arch/z16/src/z16f/z16f_irq.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * arch/z16/src/z16f/z16f_irq.c
  *
- *   Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -45,7 +30,7 @@
 #include <arch/irq.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
@@ -148,14 +133,14 @@ void up_enable_irq(int irq)
 }
 
 /****************************************************************************
- * Name: up_ack_irq
+ * Name: z16_ack_irq
  *
  * Description:
  *   Acknowledge the interrupt
  *
  ****************************************************************************/
 
-void up_ack_irq(int irq)
+void z16_ack_irq(int irq)
 {
   /* System exceptions cannot be disabled or acknowledged */
 
diff --git a/arch/z16/src/z16f/z16f_lowuart.S b/arch/z16/src/z16f/z16f_lowuart.S
index 327c008..8afbfbf 100644
--- a/arch/z16/src/z16f/z16f_lowuart.S
+++ b/arch/z16/src/z16f/z16f_lowuart.S
@@ -2,35 +2,20 @@
  * arch/z16/src/z16f/z16f_lowuart.asm
  * Z16F UART management
  *
- *   Copyright (C) 2008, 2012, 2014 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  *************************************************************************/
 
@@ -40,7 +25,7 @@
 
 #include <nuttx/config.h>
 #include "chip.h"
-#include "common/up_internal.h"
+#include "common/z16_internal.h"
 
 #ifdef USE_LOWUARTINIT
 
@@ -67,7 +52,7 @@
 	xdef	_z16f_lowuartinit
 	xref	_SYS_CLK_FREQ:EROM
 #ifdef CONFIG_Z16_LOWPUTC
-	xdef	_up_lowputc
+	xdef	_z16_lowputc
 #endif
 #ifdef CONFIG_Z16_LOWGETC
 	xdef	_z16_lowgetc
@@ -149,7 +134,7 @@ _z16f_lowuartinit:
 #endif /* USE_LOWUARTINIT */
 
 /*************************************************************************
- * Name: _up_lowputc
+ * Name: _z16_lowputc
  *
  * Description:
  *   Send one character to the selected serial console
@@ -165,7 +150,7 @@ _z16f_lowuartinit:
  *************************************************************************/
 
 #ifdef CONFIG_Z16_LOWPUTC
-_up_lowputc:
+_z16_lowputc:
 
 #ifdef HAVE_Z16F_SERIAL_CONSOLE
 	/* Check if the character to output is a linefeed */
@@ -186,7 +171,7 @@ _up_lowputc:
  * Name: _z16f_xmitc
  *
  * Description:
- *   Send one character on the selected port (really a part of up_lowputc)
+ *   Send one character on the selected port (really a part of z16_lowputc)
  *
  * Input Parameters:
  *   r1 = character
diff --git a/arch/z16/src/z16f/z16f_restoreusercontext.S b/arch/z16/src/z16f/z16f_restoreusercontext.S
index a8ed1c6..75e6cfa 100644
--- a/arch/z16/src/z16f/z16f_restoreusercontext.S
+++ b/arch/z16/src/z16f/z16f_restoreusercontext.S
@@ -1,35 +1,20 @@
 /*************************************************************************
  * arch/z16/src/z16f/z16f_restoreusercontext.asm
  *
- *   Copyright (C) 2008 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  *************************************************************************/
 
@@ -45,7 +30,7 @@
  * External References / External Definitions
  *************************************************************************/
 
-	xdef	_up_restoreusercontext
+	xdef	_z16_restoreusercontext
 
 /*************************************************************************
  * Data Allocation
@@ -59,7 +44,7 @@
  *************************************************************************/
 
 /*************************************************************************
- * Name: up_restoreusercontext
+ * Name: z16_restoreusercontext
  *
  * Description:
  *   Restore the current user context.
@@ -69,7 +54,7 @@
  *
  *************************************************************************/
 
-_up_restoreusercontext:
+_z16_restoreusercontext:
 	/* Disable interrupts while we are accessing the TCB's register
 	 * save structure.  The correct interrupt state will be restored
 	 * by the iret instruction below.
diff --git a/arch/z16/src/z16f/z16f_saveusercontext.S b/arch/z16/src/z16f/z16f_saveusercontext.S
index d18bf95..d6d7f86 100644
--- a/arch/z16/src/z16f/z16f_saveusercontext.S
+++ b/arch/z16/src/z16f/z16f_saveusercontext.S
@@ -4,32 +4,20 @@
  *   Copyright (C) 2008 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt <gn...@nuttx.org>
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * 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.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 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.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  *************************************************************************/
 
@@ -45,7 +33,7 @@
  * External References / External Definitions
  *************************************************************************/
 
-	xdef	_up_saveusercontext
+	xdef	_z16_saveusercontext
 
 /*************************************************************************
  * Data Allocation
@@ -59,7 +47,7 @@
  *************************************************************************/
 
 /*************************************************************************
- * Name: up_saveusercontext
+ * Name: z16_saveusercontext
  *
  * Description:
  *   Save the current user context.
@@ -74,7 +62,7 @@
  *
  *************************************************************************/
 
-_up_saveusercontext:
+_z16_saveusercontext:
 	/* Save the flags (needed to restore the interrupt state) */
 
 	ld.ub	r3, Z16F_CNTRL_FLAGS	/* Fetch the flags register (zero padded) */
diff --git a/arch/z16/src/z16f/z16f_serial.c b/arch/z16/src/z16f/z16f_serial.c
index e078cd9..a0c5535 100644
--- a/arch/z16/src/z16f/z16f_serial.c
+++ b/arch/z16/src/z16f/z16f_serial.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * arch/z16/src/z16f/z16f_serial.c
  *
- *   Copyright (C) 2008-2009, 2012, 2014, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -52,7 +37,7 @@
 #include <nuttx/serial/serial.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 #ifdef USE_SERIALDRIVER
 
@@ -691,7 +676,7 @@ static bool z16f_txempty(struct uart_dev_s *dev)
 #ifdef USE_EARLYSERIALINIT
 
 /****************************************************************************
- * Name: up_earlyserialinit
+ * Name: z16_earlyserialinit
  *
  * Description:
  *   Performs the low level UART initialization early in debug so that the
@@ -700,7 +685,7 @@ static bool z16f_txempty(struct uart_dev_s *dev)
  *
  ****************************************************************************/
 
-void up_earlyserialinit(void)
+void z16_earlyserialinit(void)
 {
   uint8_t regval;
 
@@ -752,15 +737,15 @@ void up_earlyserialinit(void)
 #endif
 
 /****************************************************************************
- * Name: up_serialinit
+ * Name: z16_serialinit
  *
  * Description:
  *   Register serial console and serial ports.  This assumes that
- *   up_earlyserialinit was called previously.
+ *   z16_earlyserialinit was called previously.
  *
  ****************************************************************************/
 
-void up_serialinit(void)
+void z16_serialinit(void)
 {
 #ifdef CONSOLE_DEV
   uart_register("/dev/console", &CONSOLE_DEV);
diff --git a/arch/z16/src/z16f/z16f_sysexec.c b/arch/z16/src/z16f/z16f_sysexec.c
index afe6168..25afe02 100644
--- a/arch/z16/src/z16f/z16f_sysexec.c
+++ b/arch/z16/src/z16f/z16f_sysexec.c
@@ -45,7 +45,7 @@
 #include <nuttx/arch.h>
 
 #include "chip.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/z16/src/z16f/z16f_timerisr.c b/arch/z16/src/z16f/z16f_timerisr.c
index c827148..748ec0d 100644
--- a/arch/z16/src/z16f/z16f_timerisr.c
+++ b/arch/z16/src/z16f/z16f_timerisr.c
@@ -47,7 +47,7 @@
 
 #include "chip.h"
 #include "clock/clock.h"
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
index 255a132..f7a99a2 100644
--- a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
+++ b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c
@@ -50,7 +50,7 @@
 #include <nuttx/board.h>
 #include <arch/board/board.h>
 
-#include "up_internal.h"
+#include "z16_internal.h"
 
 /****************************************************************************
  * Pre-processor Definitions