20#ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_STRUCTS_H_
21#define ZEPHYR_KERNEL_INCLUDE_KERNEL_STRUCTS_H_
23#if !defined(_ASMLANGUAGE)
35#define K_NUM_THREAD_PRIO (CONFIG_NUM_PREEMPT_PRIORITIES + CONFIG_NUM_COOP_PRIORITIES + 1)
37#if defined(CONFIG_64BIT)
38#define PRIQ_BITMAP_SIZE (DIV_ROUND_UP(K_NUM_THREAD_PRIO, 8 * sizeof(uint64_t)))
40#define PRIQ_BITMAP_SIZE (DIV_ROUND_UP(K_NUM_THREAD_PRIO, 8 * sizeof(uint32_t)))
58#define _THREAD_DUMMY (BIT(0))
61#define _THREAD_PENDING (BIT(1))
64#define _THREAD_PRESTART (BIT(2))
67#define _THREAD_DEAD (BIT(3))
70#define _THREAD_SUSPENDED (BIT(4))
73#define _THREAD_ABORTING (BIT(5))
76#define _THREAD_SUSPENDING (BIT(6))
79#define _THREAD_QUEUED (BIT(7))
83#ifdef CONFIG_STACK_SENTINEL
85#define STACK_SENTINEL 0xF0F0F0F0
89#define _NON_PREEMPT_THRESHOLD 0x0080U
92#define _PREEMPT_THRESHOLD (_NON_PREEMPT_THRESHOLD - 1U)
94#if !defined(_ASMLANGUAGE)
143#if defined(CONFIG_SCHED_DUMB)
145#elif defined(CONFIG_SCHED_SCALABLE)
146 struct _priq_rb runq;
147#elif defined(CONFIG_SCHED_MULTIQ)
148 struct _priq_mq runq;
152typedef struct _ready_q _ready_q_t;
167#ifdef CONFIG_SCHED_CPU_MASK_PIN_ONLY
168 struct _ready_q ready_q;
171#if (CONFIG_NUM_METAIRQ_PRIORITIES > 0) && \
172 (CONFIG_NUM_COOP_PRIORITIES > CONFIG_NUM_METAIRQ_PRIORITIES)
179#if defined(CONFIG_FPU_SHARING)
188#ifdef CONFIG_SCHED_THREAD_USAGE
197#ifdef CONFIG_SCHED_THREAD_USAGE_ALL
202#ifdef CONFIG_OBJ_CORE_SYSTEM
207 struct _cpu_arch arch;
210typedef struct _cpu _cpu_t;
213 struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS];
223#ifndef CONFIG_SCHED_CPU_MASK_PIN_ONLY
224 struct _ready_q ready_q;
227#ifdef CONFIG_FPU_SHARING
241#if defined(CONFIG_THREAD_MONITOR)
244#ifdef CONFIG_SCHED_THREAD_USAGE_ALL
248#ifdef CONFIG_OBJ_CORE_SYSTEM
252#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_IPI_SUPPORTED)
258typedef struct z_kernel _kernel_t;
260extern struct z_kernel _kernel;
269bool z_smp_cpu_mobile(
void);
271#define _current_cpu ({ __ASSERT_NO_MSG(!z_smp_cpu_mobile()); \
273#define _current k_sched_current_thread_query()
276#define _current_cpu (&_kernel.cpus[0])
277#define _current _kernel.cpus[0].current
281#ifdef CONFIG_WAITQ_SCALABLE
284 struct _priq_rb waitq;
288bool z_priq_rb_lessthan(
struct rbnode *a,
struct rbnode *b);
290#define Z_WAIT_Q_INIT(wait_q) { { { .lessthan_fn = z_priq_rb_lessthan } } }
298#define Z_WAIT_Q_INIT(wait_q) { SYS_DLIST_STATIC_INIT(&(wait_q)->waitq) }
304typedef void (*_timeout_func_t)(
struct _timeout *t);
309#ifdef CONFIG_TIMEOUT_64BIT
long atomic_t
Definition: atomic_types.h:15
struct _dnode sys_dnode_t
Doubly-linked list node structure.
Definition: dlist.h:54
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition: dlist.h:50
#define PRIQ_BITMAP_SIZE
Definition: kernel_structs.h:40
void(* k_thread_timeslice_fn_t)(struct k_thread *thread, void *data)
Definition: kernel_structs.h:317
#define K_NUM_THREAD_PRIO
Definition: kernel_structs.h:35
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__INT64_TYPE__ int64_t
Definition: stdint.h:75
Structure used to track internal statistics about both thread and CPU usage.
Definition: stats.h:18
Object core structure.
Definition: obj_core.h:121
Thread Structure.
Definition: thread.h:260
Balanced red/black tree node structure.
Definition: rb.h:58
Balanced red/black tree structure.
Definition: rb.h:91