From bb4a5c5cdf950ee101eddca46eafa8c9682a4e54 Mon Sep 17 00:00:00 2001
From: Kaspar Schleiser <kaspar@schleiser.de>
Date: Fri, 20 Oct 2017 17:03:46 +0200
Subject: [PATCH] core: remove COREIF_NG

---
 core/include/arch/irq_arch.h    | 81 ----------------------------
 core/include/arch/panic_arch.h  | 39 --------------
 core/include/arch/thread_arch.h | 96 ---------------------------------
 core/include/irq.h              |  1 -
 core/include/panic.h            |  8 +++
 core/include/sched.h            |  6 ++-
 core/include/thread.h           | 31 ++++++++++-
 core/panic.c                    |  1 -
 8 files changed, 43 insertions(+), 220 deletions(-)
 delete mode 100644 core/include/arch/irq_arch.h
 delete mode 100644 core/include/arch/panic_arch.h
 delete mode 100644 core/include/arch/thread_arch.h

diff --git a/core/include/arch/irq_arch.h b/core/include/arch/irq_arch.h
deleted file mode 100644
index 306aac3a3a..0000000000
--- a/core/include/arch/irq_arch.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2014 Freie Universität Berlin
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License v2.1. See the file LICENSE in the top level
- * directory for more details.
- */
-
-/**
- * @ingroup     core_arch
- * @{
- *
- * @file
- * @brief       Interrupt handling interface for globally en- and disabling interrupts
- *
- * This file acts as a wrapper between the kernels interrupt interface and the architecture
- * dependent implementation of the interfaces.
- *
- * @note All functions in this module have to be implemented in a way that it
- *       is safe to call them from within the context of an ISR.
- *
- * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
- */
-
-#ifndef ARCH_IRQ_ARCH_H
-#define ARCH_IRQ_ARCH_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/**
- * @name Define mapping between kernel internal and arch interfaces
- *
- * This mapping is done for compatibility of existing platforms,
- * new platforms should always use the *_arch_* interfaces.
- * @{
- */
-#ifdef COREIF_NG
-#define irq_enable      irq_arch_enable
-#define irq_disable     irq_arch_disable
-#define irq_restore     irq_arch_restore
-#define irq_is_in       irq_arch_in
-#endif
-/** @} */
-
-/**
- * @brief Globally enable maskable interrupt sources
- *
- * @return              the IRQ state after enabling interrupts
- */
-unsigned int irq_arch_enable(void);
-
-/**
- * @brief Globally disable all maskable interrupt sources
- *
- * @return              the IRQ state before disabling interrupts
- */
-unsigned int irq_arch_disable(void);
-
-
-/**
- * @brief Restore a previously recorded IRQ state
- *
- * @param[in] state     the state to set the IRQ flags to
- */
-void irq_arch_restore(unsigned int state);
-
-/**
- * @brief See if the current context is inside an ISR
- *
- * @return              1 if currently in interrupt context, 0 otherwise
- */
-int irq_arch_in(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ARCH_IRQ_ARCH_H */
-/** @} */
diff --git a/core/include/arch/panic_arch.h b/core/include/arch/panic_arch.h
deleted file mode 100644
index f103239b4d..0000000000
--- a/core/include/arch/panic_arch.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2015 INRIA
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License v2.1. See the file LICENSE in the top level
- * directory for more details.
- */
-
-/**
- * @ingroup     core_arch
- * @{
- *
- * @file
- * @brief       Architecture dependent panic function
- *
- * @author      Oliver Hahm <oliver.hahm@inria.fr>
- */
-
-#ifndef ARCH_PANIC_ARCH_H
-#define ARCH_PANIC_ARCH_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
- /**
-  * @brief architecture dependent handling of an panic case
-  *
-  * This function gives the CPU the possibility to execute architecture
-  * dependent code in case of an severe error.
-  */
-void panic_arch(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ARCH_PANIC_ARCH_H */
-/** @} */
diff --git a/core/include/arch/thread_arch.h b/core/include/arch/thread_arch.h
deleted file mode 100644
index 40ced57027..0000000000
--- a/core/include/arch/thread_arch.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2014 Freie Universität Berlin
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License v2.1. See the file LICENSE in the top level
- * directory for more details.
- */
-
-/**
- * @ingroup     core_arch
- * @{
- *
- * @file
- * @brief       Architecture dependent kernel interface for handling and managing threads
- *
- * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
- */
-
-#ifndef ARCH_THREAD_ARCH_H
-#define ARCH_THREAD_ARCH_H
-
-#include "kernel_defines.h"
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/**
- * @name Define the mapping between the architecture independent interfaces
- *       and the kernel internal interfaces
- *
- * This mapping is done for compatibility of existing platforms,
- * new platforms should always use the *_arch_* interfaces.
- * @{
- */
-#ifdef COREIF_NG
-#define thread_stack_init               thread_arch_stack_init
-#define thread_print_stack              thread_arch_stack_print
-#define cpu_switch_context_exit         thread_arch_start_threading
-#define thread_yield_higher             thread_arch_yield
-#endif
-/** @} */
-
-/**
- * @brief Prototype for a thread entry function
- */
-typedef void *(*thread_task_func_t)(void *arg);
-
-/**
- * @brief Initialize a thread's stack
- *
- * @param[in] task_func     pointer to the thread's code
- * @param[in] arg           argument to task_func
- * @param[in] stack_start   pointer to the start address of the thread
- * @param[in] stack_size    the maximum size of the stack
- *
- * @return                  pointer to the new top of the stack
- */
-char *thread_arch_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stack_size);
-
-/**
- * @brief   Get the number of bytes used on the ISR stack
- */
-int thread_arch_isr_stack_usage(void);
-
-/**
- * @brief   Get the current ISR stack pointer
- */
-void *thread_arch_isr_stack_pointer(void);
-
-/**
- * @brief   Get the start of the ISR stack
- */
-void *thread_arch_isr_stack_start(void);
-
-/**
- * @brief Print the current stack to stdout
- */
-void thread_arch_stack_print(void);
-
-/**
- * @brief Start threading by loading a threads initial information from the stack
- */
-void thread_arch_start_threading(void) NORETURN;
-
-/**
- * @brief Pause the current thread and schedule the next pending, if available
- */
-void thread_arch_yield(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ARCH_THREAD_ARCH_H */
-/** @} */
diff --git a/core/include/irq.h b/core/include/irq.h
index 048a9ed472..29a969a023 100644
--- a/core/include/irq.h
+++ b/core/include/irq.h
@@ -22,7 +22,6 @@
 #define IRQ_H
 
 #include <stdbool.h>
-#include "arch/irq_arch.h"
 
 #ifdef __cplusplus
  extern "C" {
diff --git a/core/include/panic.h b/core/include/panic.h
index 5d10aab624..17ad39b127 100644
--- a/core/include/panic.h
+++ b/core/include/panic.h
@@ -74,6 +74,14 @@ typedef enum {
  * */
 NORETURN void core_panic(core_panic_t crash_code, const char *message);
 
+/**
+ * @brief architecture dependent handling of an panic case
+ *
+ * This function gives the CPU the possibility to execute architecture
+ * dependent code in case of an severe error.
+ */
+void panic_arch(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/core/include/sched.h b/core/include/sched.h
index 67c85fa203..63a27c5e7c 100644
--- a/core/include/sched.h
+++ b/core/include/sched.h
@@ -136,7 +136,11 @@ void sched_switch(uint16_t other_prio);
 /**
  * @brief   Call context switching at thread exit
  */
-NORETURN void cpu_switch_context_exit(void);
+extern void thread_start_threading(void);
+NORETURN static inline void cpu_switch_context_exit(void)
+{
+    thread_start_threading();
+}
 
 /**
  * Flag indicating whether a context switch is necessary after handling an
diff --git a/core/include/thread.h b/core/include/thread.h
index 00223e2396..706f3e57bd 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -122,7 +122,6 @@
 #include "clist.h"
 #include "cib.h"
 #include "msg.h"
-#include "arch/thread_arch.h"
 #include "cpu_conf.h"
 #include "sched.h"
 
@@ -167,6 +166,11 @@
 #define STATUS_PENDING         10               /**< waiting to be scheduled to run     */
 /** @} */
 
+/**
+ * @brief Prototype for a thread entry function
+ */
+typedef void *(*thread_task_func_t)(void *arg);
+
 /**
  * @brief @c thread_t holds thread's context data.
  */
@@ -462,11 +466,36 @@ const char *thread_getname(kernel_pid_t pid);
 uintptr_t thread_measure_stack_free(char *stack);
 #endif /* DEVELHELP */
 
+/**
+ * @brief   Get the number of bytes used on the ISR stack
+ */
+int thread_isr_stack_usage(void);
+
+/**
+ * @brief   Get the current ISR stack pointer
+ */
+void *thread_isr_stack_pointer(void);
+
+/**
+ * @brief   Get the start of the ISR stack
+ */
+void *thread_isr_stack_start(void);
+
+/**
+ * @brief Print the current stack to stdout
+ */
+void thread_stack_print(void);
+
 /**
  * @brief   Prints human readable, ps-like thread information for debugging purposes
  */
 void thread_print_stack(void);
 
+/**
+ * @brief Start threading by loading a threads initial information from the stack
+ */
+void thread_start_threading(void) NORETURN;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/core/panic.c b/core/panic.c
index d3052ab0e7..d107d8f36c 100644
--- a/core/panic.c
+++ b/core/panic.c
@@ -29,7 +29,6 @@
 #include "cpu.h"
 #include "irq.h"
 #include "panic.h"
-#include "arch/panic_arch.h"
 #include "periph/pm.h"
 #include "log.h"
 
-- 
GitLab