Merge pull request #15481 from kaspar030/refactor_thread_defines
core: move scheduler defines
This commit is contained in:
commit
b3b07e4e33
@ -49,51 +49,6 @@ typedef signed ssize_t;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -167,7 +167,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "kernel_types.h"
|
|
||||||
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -81,8 +81,9 @@
|
|||||||
#define SCHED_H
|
#define SCHED_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "kernel_defines.h"
|
#include "kernel_defines.h"
|
||||||
#include "kernel_types.h"
|
|
||||||
#include "native_sched.h"
|
#include "native_sched.h"
|
||||||
#include "clist.h"
|
#include "clist.h"
|
||||||
|
|
||||||
@ -90,6 +91,50 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
* @brief forward declaration for thread_t, defined in thread.h
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
|
|
||||||
|
#include <limits.h> /* for INT_MAX */
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@
|
|||||||
#ifndef PERIPH_CPU_H
|
#ifndef PERIPH_CPU_H
|
||||||
#define PERIPH_CPU_H
|
#define PERIPH_CPU_H
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "macros/units.h"
|
#include "macros/units.h"
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#ifndef PIR_H
|
#ifndef PIR_H
|
||||||
#define PIR_H
|
#define PIR_H
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
#include "stdbool.h"
|
#include "stdbool.h"
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "cib.h"
|
#include "cib.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "mbox.h"
|
#include "mbox.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
|||||||
@ -0,0 +1,39 @@
|
|||||||
|
From 51d973f2a0a04a716af8260c62fb5045356a30a5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kaspar Schleiser <kaspar@schleiser.de>
|
||||||
|
Date: Mon, 23 Nov 2020 12:44:54 +0100
|
||||||
|
Subject: [PATCH] adapt to moved kernel_pid_t location
|
||||||
|
|
||||||
|
---
|
||||||
|
face-table.h | 2 +-
|
||||||
|
ndn.h | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/face-table.h b/face-table.h
|
||||||
|
index 28b44a5c02..fb0c39b083 100644
|
||||||
|
--- a/face-table.h
|
||||||
|
+++ b/face-table.h
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
#ifndef NDN_FACE_TABLE_H_
|
||||||
|
#define NDN_FACE_TABLE_H_
|
||||||
|
|
||||||
|
-#include <kernel_types.h>
|
||||||
|
+#include "sched.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
diff --git a/ndn.h b/ndn.h
|
||||||
|
index d8d148c7f7..47d2032301 100644
|
||||||
|
--- a/ndn.h
|
||||||
|
+++ b/ndn.h
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
#ifndef NDN_H_
|
||||||
|
#define NDN_H_
|
||||||
|
|
||||||
|
-#include <kernel_types.h>
|
||||||
|
+#include "sched.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
--
|
||||||
|
2.29.2
|
||||||
|
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "dpl_types.h"
|
#include "dpl_types.h"
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -25,7 +25,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "can/candev.h"
|
#include "can/candev.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef MODULE_CAN_PM
|
#ifdef MODULE_CAN_PM
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "can/can.h"
|
#include "can/can.h"
|
||||||
#include "can/common.h"
|
#include "can/common.h"
|
||||||
#include "can/device.h"
|
#include "can/device.h"
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "net/fib/table.h"
|
#include "net/fib/table.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "universal_address.h"
|
#include "universal_address.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@
|
|||||||
#ifndef NET_GNRC_IPV6_H
|
#ifndef NET_GNRC_IPV6_H
|
||||||
#define NET_GNRC_IPV6_H
|
#define NET_GNRC_IPV6_H
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "net/gnrc.h"
|
#include "net/gnrc.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#ifdef MODULE_GNRC_NETIF_BUS
|
#ifdef MODULE_GNRC_NETIF_BUS
|
||||||
#include "msg_bus.h"
|
#include "msg_bus.h"
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "net/gnrc/nettype.h"
|
#include "net/gnrc/nettype.h"
|
||||||
#include "net/gnrc/pkt.h"
|
#include "net/gnrc/pkt.h"
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "net/gnrc/nettype.h"
|
#include "net/gnrc/nettype.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#ifndef NET_GNRC_PKTDUMP_H
|
#ifndef NET_GNRC_PKTDUMP_H
|
||||||
#define NET_GNRC_PKTDUMP_H
|
#define NET_GNRC_PKTDUMP_H
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -137,7 +137,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#include "net/gnrc/sixlowpan/config.h"
|
#include "net/gnrc/sixlowpan/config.h"
|
||||||
#include "net/gnrc/sixlowpan/frag.h"
|
#include "net/gnrc/sixlowpan/frag.h"
|
||||||
|
|||||||
@ -88,7 +88,7 @@ gnrc_sixlowpan_frag_fb_t *gnrc_sixlowpan_frag_fb_get_by_tag(uint16_t tag);
|
|||||||
uint16_t gnrc_sixlowpan_frag_fb_next_tag(void);
|
uint16_t gnrc_sixlowpan_frag_fb_next_tag(void);
|
||||||
|
|
||||||
#if defined(TEST_SUITES) && !defined(DOXYGEN)
|
#if defined(TEST_SUITES) && !defined(DOXYGEN)
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
/* can't include `net/sixlowpan.h` as this would create a cyclical include */
|
/* can't include `net/sixlowpan.h` as this would create a cyclical include */
|
||||||
extern kernel_pid_t gnrc_sixlowpan_get_pid(void);
|
extern kernel_pid_t gnrc_sixlowpan_get_pid(void);
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "clist.h"
|
#include "clist.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "kernel_defines.h"
|
#include "kernel_defines.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
#include <sys/types.h> /* for off_t etc. */
|
#include <sys/types.h> /* for off_t etc. */
|
||||||
#include <sys/statvfs.h> /* for struct statvfs */
|
#include <sys/statvfs.h> /* for struct statvfs */
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "clist.h"
|
#include "clist.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#endif /* MODULE_CORE_MSG */
|
#endif /* MODULE_CORE_MSG */
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "rmutex.h"
|
#include "rmutex.h"
|
||||||
|
|
||||||
#ifdef MODULE_ZTIMER_XTIMER_COMPAT
|
#ifdef MODULE_ZTIMER_XTIMER_COMPAT
|
||||||
|
|||||||
@ -234,7 +234,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#endif /* MODULE_CORE_MSG */
|
#endif /* MODULE_CORE_MSG */
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#include "ztimer.h"
|
#include "ztimer.h"
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "byteorder.h"
|
#include "byteorder.h"
|
||||||
#include "cpu_conf.h"
|
#include "cpu_conf.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "net/gnrc.h"
|
#include "net/gnrc.h"
|
||||||
#include "net/gnrc/icmpv6.h"
|
#include "net/gnrc/icmpv6.h"
|
||||||
#include "net/gnrc/sixlowpan/ctx.h"
|
#include "net/gnrc/sixlowpan/ctx.h"
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "bitfield.h"
|
#include "bitfield.h"
|
||||||
#include "evtimer_msg.h"
|
#include "evtimer_msg.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "net/eui64.h"
|
#include "net/eui64.h"
|
||||||
#include "net/ipv6/addr.h"
|
#include "net/ipv6/addr.h"
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "net/gnrc.h"
|
#include "net/gnrc.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
#ifdef MODULE_SCHEDSTATISTICS
|
#ifdef MODULE_SCHEDSTATISTICS
|
||||||
#include "schedstatistics.h"
|
#include "schedstatistics.h"
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "sema.h"
|
#include "sema.h"
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "bitfield.h"
|
#include "bitfield.h"
|
||||||
#include "byteorder.h"
|
#include "byteorder.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#ifdef MODULE_LUID
|
#ifdef MODULE_LUID
|
||||||
#include "luid.h"
|
#include "luid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "clist.h"
|
#include "clist.h"
|
||||||
|
|
||||||
#define ENABLE_DEBUG 0
|
#define ENABLE_DEBUG 0
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include "cib.h"
|
#include "cib.h"
|
||||||
#include "clist.h"
|
#include "clist.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "mbox.h"
|
#include "mbox.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "bitarithm.h"
|
#include "bitarithm.h"
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "kernel_types.h"
|
#include "sched.h"
|
||||||
|
|
||||||
/* One stack for all threads. DON'T TRY THIS AT HOME!! */
|
/* One stack for all threads. DON'T TRY THIS AT HOME!! */
|
||||||
static char dummy_stack[THREAD_STACKSIZE_IDLE];
|
static char dummy_stack[THREAD_STACKSIZE_IDLE];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user