From 369e9b30e25807f01fb69baa52dd64d7d98c286f Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 20 Nov 2020 11:49:41 +0100 Subject: [PATCH] core: move scheduler defines to sched.h --- core/include/kernel_types.h | 53 ------------------------------------- core/include/sched.h | 45 ++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/core/include/kernel_types.h b/core/include/kernel_types.h index 858035314d..f99f343433 100644 --- a/core/include/kernel_types.h +++ b/core/include/kernel_types.h @@ -45,58 +45,5 @@ typedef signed ssize_t; # endif #endif -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @def MAXTHREADS - * @brief The maximum number of threads to be scheduled - */ -#ifndef MAXTHREADS -#define MAXTHREADS 32 -#endif - -/** - * Canonical identifier for an invalid PID. - */ -#define KERNEL_PID_UNDEF 0 - -/** - * The first valid PID (inclusive). - */ -#define KERNEL_PID_FIRST (KERNEL_PID_UNDEF + 1) - -/** - * The last valid PID (inclusive). - */ -#define KERNEL_PID_LAST (KERNEL_PID_FIRST + MAXTHREADS - 1) - -/** - * Macro for printing formatter - */ -#define PRIkernel_pid PRIi16 - -/** - * Unique process identifier - */ -typedef int16_t kernel_pid_t; - -/** - * @brief Determine if the given pid is valid - * - * @param[in] pid The pid to check - * - * @return true if the pid is valid, false otherwise - */ -static inline int pid_is_valid(kernel_pid_t pid) -{ - return ((KERNEL_PID_FIRST <= pid) && (pid <= KERNEL_PID_LAST)); -} - -#ifdef __cplusplus -} -#endif - #endif /* KERNEL_TYPES_H */ /** @} */ diff --git a/core/include/sched.h b/core/include/sched.h index 214d7af327..d0a4704f86 100644 --- a/core/include/sched.h +++ b/core/include/sched.h @@ -82,7 +82,6 @@ #include #include "kernel_defines.h" -#include "kernel_types.h" #include "native_sched.h" #include "clist.h" @@ -90,6 +89,50 @@ extern "C" { #endif +/** + * @def MAXTHREADS + * @brief The maximum number of threads to be scheduled + */ +#ifndef MAXTHREADS +#define MAXTHREADS 32 +#endif + +/** + * Canonical identifier for an invalid PID. + */ +#define KERNEL_PID_UNDEF 0 + +/** + * The first valid PID (inclusive). + */ +#define KERNEL_PID_FIRST (KERNEL_PID_UNDEF + 1) + +/** + * The last valid PID (inclusive). + */ +#define KERNEL_PID_LAST (KERNEL_PID_FIRST + MAXTHREADS - 1) + +/** + * Macro for printing formatter + */ +#define PRIkernel_pid PRIi16 + +/** + * Unique process identifier + */ +typedef int16_t kernel_pid_t; + +/** + * @brief Determine if the given pid is valid + * + * @param[in] pid The pid to check + * + * @return true if the pid is valid, false otherwise + */ +static inline int pid_is_valid(kernel_pid_t pid) +{ + return ((KERNEL_PID_FIRST <= pid) && (pid <= KERNEL_PID_LAST)); +} /** * @brief forward declaration for thread_t, defined in thread.h */