23 #ifndef _XENO_NUCLEUS_SCHED_RT_H
24 #define _XENO_NUCLEUS_SCHED_RT_H
26 #ifndef _XENO_NUCLEUS_SCHED_H
27 #error "please don't include nucleus/sched-rt.h directly"
31 #define XNSCHED_RT_MIN_PRIO 0
32 #define XNSCHED_RT_MAX_PRIO 257
33 #define XNSCHED_RT_NR_PRIO (XNSCHED_RT_MAX_PRIO - XNSCHED_RT_MIN_PRIO + 1)
45 #define XNSCHED_LOW_PRIO 0
46 #define XNSCHED_HIGH_PRIO 99
47 #define XNSCHED_IRQ_PRIO XNSCHED_RT_MAX_PRIO
49 #if defined(__KERNEL__) || defined(__XENO_SIM__)
51 #if XNSCHED_RT_NR_PRIO > XNSCHED_CLASS_MAX_PRIO || \
52 (defined(CONFIG_XENO_OPT_SCALABLE_SCHED) && \
53 XNSCHED_RT_NR_PRIO > XNSCHED_MLQ_LEVELS)
54 #error "RT class has too many priority levels"
57 extern struct xnsched_class xnsched_class_rt;
59 extern struct xnsched_class xnsched_class_idle;
61 #define xnsched_class_default xnsched_class_rt
63 static inline void __xnsched_rt_requeue(
struct xnthread *thread)
65 sched_insertpql(&thread->sched->rt.runnable,
66 &thread->rlink, thread->cprio);
69 static inline void __xnsched_rt_enqueue(
struct xnthread *thread)
71 sched_insertpqf(&thread->sched->rt.runnable,
72 &thread->rlink, thread->cprio);
75 static inline void __xnsched_rt_dequeue(
struct xnthread *thread)
77 sched_removepq(&thread->sched->rt.runnable, &thread->rlink);
80 static inline struct xnthread *__xnsched_rt_pick(
struct xnsched *sched)
82 struct xnpholder *h = sched_getpq(&sched->
rt.runnable);
83 return h ? link2thread(h, rlink) : NULL;
86 static inline void __xnsched_rt_setparam(
struct xnthread *thread,
87 const union xnsched_policy_param *p)
89 thread->cprio = p->rt.prio;
92 xnthread_clear_state(thread,
XNOTHER);
94 xnthread_set_state(thread,
XNOTHER);
98 static inline void __xnsched_rt_getparam(
struct xnthread *thread,
99 union xnsched_policy_param *p)
101 p->rt.prio = thread->cprio;
104 static inline void __xnsched_rt_trackprio(
struct xnthread *thread,
105 const union xnsched_policy_param *p)
108 __xnsched_rt_setparam(thread, p);
110 thread->cprio = thread->bprio;
113 static inline void __xnsched_rt_forget(
struct xnthread *thread)
117 static inline int xnsched_rt_init_tcb(
struct xnthread *thread)
122 void xnsched_rt_tick(
struct xnthread *curr);
124 #ifdef CONFIG_XENO_OPT_PRIOCPL
126 static inline struct xnthread *__xnsched_rt_push_rpi(
struct xnsched *sched,
127 struct xnthread *thread)
129 sched_insertpqf(&sched->
rt.relaxed, &thread->xlink, thread->cprio);
130 return link2thread(sched_getheadpq(&sched->
rt.relaxed), xlink);
133 static inline void __xnsched_rt_pop_rpi(
struct xnthread *thread)
135 struct xnsched *sched = thread->rpi;
136 sched_removepq(&sched->
rt.relaxed, &thread->xlink);
139 static inline struct xnthread *__xnsched_rt_peek_rpi(
struct xnsched *sched)
141 struct xnpholder *h = sched_getheadpq(&sched->
rt.relaxed);
142 return h ? link2thread(h, xlink) : NULL;
145 static inline void __xnsched_rt_suspend_rpi(
struct xnthread *thread)
149 static inline void __xnsched_rt_resume_rpi(
struct xnthread *thread)
#define XNOTHER
Non real-time shadow (prio=0)
Definition: thread.h:65
#define XNSHADOW
Shadow thread.
Definition: thread.h:63
Scheduling information structure.
Definition: sched.h:66
struct xnsched_rt rt
Definition: sched.h:76
#define XNBOOST
Undergoes a PIP boost.
Definition: thread.h:48