1 |
|
/* schedule.h - Public interface to the L4 scheduler. |
2 |
|
Copyright (C) 2003 Free Software Foundation, Inc. |
3 |
|
Written by Marcus Brinkmann <marcus@gnu.org>. |
4 |
|
|
5 |
|
This file is part of the GNU L4 library. |
6 |
|
|
7 |
|
The GNU L4 library is free software; you can redistribute it and/or |
8 |
|
modify it under the terms of the GNU Lesser General Public License |
9 |
|
as published by the Free Software Foundation; either version 2.1 of |
10 |
|
the License, or (at your option) any later version. |
11 |
|
|
12 |
|
The GNU L4 library is distributed in the hope that it will be |
13 |
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
14 |
|
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
GNU Lesser General Public License for more details. |
16 |
|
|
17 |
|
You should have received a copy of the GNU Lesser General Public |
18 |
|
License along with the GNU L4 library; if not, write to the Free |
19 |
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
20 |
|
02111-1307, USA. */ |
21 |
|
|
22 |
#ifndef _L4_SCHEDULE_H |
#ifndef _L4_SCHEDULE_H |
23 |
#define _L4_SCHEDULE_H 1 |
#define _L4_SCHEDULE_H 1 |
24 |
|
|
27 |
#include <l4/syscall.h> |
#include <l4/syscall.h> |
28 |
#include <l4/thread.h> |
#include <l4/thread.h> |
29 |
|
|
|
|
|
|
#ifndef _L4_EXTERN_INLINE |
|
|
#define _L4_EXTERN_INLINE extern __inline |
|
|
#endif |
|
|
|
|
30 |
|
|
31 |
/* FIXME: These are compound statements and can not be used for |
/* FIXME: These are compound statements and can not be used for |
32 |
initialization of global variables in C99. */ |
initialization of global variables in C99. */ |
34 |
#define l4_zero_time \ |
#define l4_zero_time \ |
35 |
((l4_time_t) { .period.m = 0, .period.e = 5, .period._zero = 0 }) |
((l4_time_t) { .period.m = 0, .period.e = 5, .period._zero = 0 }) |
36 |
|
|
37 |
_L4_EXTERN_INLINE l4_time_t |
static inline l4_time_t |
38 |
|
__attribute__((__always_inline__)) |
39 |
l4_time_period (l4_uint64_t usec) |
l4_time_period (l4_uint64_t usec) |
40 |
{ |
{ |
41 |
/* FIXME: If usec is a built-in constant, optimize. Optimize the |
/* FIXME: If usec is a built-in constant, optimize. Optimize the |
59 |
|
|
60 |
/* Convenience interface for l4_thread_switch. */ |
/* Convenience interface for l4_thread_switch. */ |
61 |
|
|
62 |
_L4_EXTERN_INLINE void |
static inline void |
63 |
|
__attribute__((__always_inline__)) |
64 |
l4_yield (void) |
l4_yield (void) |
65 |
{ |
{ |
66 |
l4_thread_switch (l4_nilthread); |
l4_thread_switch (l4_nilthread); |
69 |
|
|
70 |
/* Convenience interface for l4_schedule. */ |
/* Convenience interface for l4_schedule. */ |
71 |
|
|
72 |
_L4_EXTERN_INLINE l4_word_t |
static inline l4_word_t |
73 |
|
__attribute__((__always_inline__)) |
74 |
l4_set_priority (l4_thread_id_t dest, l4_word_t priority) |
l4_set_priority (l4_thread_id_t dest, l4_word_t priority) |
75 |
{ |
{ |
76 |
l4_word_t prio = priority & ((1 << 16) - 1); |
l4_word_t prio = priority & ((1 << 16) - 1); |
79 |
} |
} |
80 |
|
|
81 |
|
|
82 |
_L4_EXTERN_INLINE l4_word_t |
static inline l4_word_t |
83 |
|
__attribute__((__always_inline__)) |
84 |
l4_set_processor_no (l4_thread_id_t dest, l4_word_t proc_num) |
l4_set_processor_no (l4_thread_id_t dest, l4_word_t proc_num) |
85 |
{ |
{ |
86 |
l4_word_t proc = proc_num & ((1 << 8) - 1); |
l4_word_t proc = proc_num & ((1 << 8) - 1); |
89 |
} |
} |
90 |
|
|
91 |
|
|
92 |
_L4_EXTERN_INLINE l4_word_t |
static inline l4_word_t |
93 |
|
__attribute__((__always_inline__)) |
94 |
l4_time_slice (l4_thread_id_t dest, l4_time_t *ts, l4_time_t *tq) |
l4_time_slice (l4_thread_id_t dest, l4_time_t *ts, l4_time_t *tq) |
95 |
{ |
{ |
96 |
l4_word_t time_control; |
l4_word_t time_control; |
100 |
} |
} |
101 |
|
|
102 |
|
|
103 |
_L4_EXTERN_INLINE l4_word_t |
static inline l4_word_t |
104 |
|
__attribute__((__always_inline__)) |
105 |
l4_set_time_slice (l4_thread_id_t dest, l4_time_t ts, l4_time_t tq) |
l4_set_time_slice (l4_thread_id_t dest, l4_time_t ts, l4_time_t tq) |
106 |
{ |
{ |
107 |
l4_word_t time_control = (ts.raw << 16) | tq.raw; |
l4_word_t time_control = (ts.raw << 16) | tq.raw; |
110 |
} |
} |
111 |
|
|
112 |
|
|
113 |
_L4_EXTERN_INLINE l4_word_t |
static inline l4_word_t |
114 |
|
__attribute__((__always_inline__)) |
115 |
l4_preemption_delay (l4_thread_id_t dest, l4_word_t sensitive_prio, |
l4_preemption_delay (l4_thread_id_t dest, l4_word_t sensitive_prio, |
116 |
l4_word_t max_delay) |
l4_word_t max_delay) |
117 |
{ |
{ |