1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_INCLUDE_POSIX_SCHED_H_
7 #define ZEPHYR_INCLUDE_POSIX_SCHED_H_
8 
9 #include <zephyr/kernel.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * Other mandatory scheduling policy. Must be numerically distinct. May
17  * execute identically to SCHED_RR or SCHED_FIFO. For Zephyr this is a
18  * pseudonym for SCHED_RR.
19  */
20 #define SCHED_OTHER 0
21 
22 /* Cooperative scheduling policy */
23 #define SCHED_FIFO 1
24 
25 /* Priority based preemptive scheduling policy */
26 #define SCHED_RR 2
27 
28 #if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
29 	|| defined(CONFIG_ARCMWDT_LIBC)
30 struct sched_param {
31 	int sched_priority;
32 };
33 #endif
34 
35 /**
36  * @brief Yield the processor
37  *
38  * See IEEE 1003.1
39  */
sched_yield(void)40 static inline int sched_yield(void)
41 {
42 	k_yield();
43 	return 0;
44 }
45 
46 int sched_get_priority_min(int policy);
47 int sched_get_priority_max(int policy);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif /* ZEPHYR_INCLUDE_POSIX_SCHED_H_ */
54