summaryrefslogtreecommitdiff
path: root/libl4/l4/gnu/schedule.h
blob: 45f43aeb62682cd0412c2850f4f4314fb3d4c8a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/* l4/gnu/schedule.h - Public GNU interface for L4 scheduling interface.
   Copyright (C) 2004 Free Software Foundation, Inc.
   Written by Marcus Brinkmann <marcus@gnu.org>.

   This file is part of the GNU L4 library.
 
   The GNU L4 library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.
 
   The GNU L4 library is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU L4 library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef _L4_SCHEDULE_H
# error "Never use <l4/gnu/schedule.h> directly; include <l4/schedule.h> instead."
#endif


typedef _L4_clock_t l4_clock_t;


static inline l4_clock_t
_L4_attribute_always_inline
l4_system_clock (void)
{
  return _L4_system_clock ();
}


typedef _L4_time_t l4_time_t;

#define L4_NEVER	_L4_never
#define L4_ZERO_TIME	_L4_zero_time

#define L4_TIME_PERIOD_MAX	_L4_TIME_PERIOD_MAX

static inline l4_time_t
_L4_attribute_always_inline
l4_time_period (l4_uint64_t usec)
{
  return _L4_time_period (usec);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_mul2 (l4_time_t t)
{
  __L4_time_t _t;

  _t.raw = t;
  if (_t.period.e == _L4_TIME_PERIOD_E_MAX)
    return L4_NEVER;
  _t.period.e++;
  return _t.raw;
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_point (l4_uint64_t at)
{
  return _L4_time_point (at);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_add_usec (l4_time_t l, l4_word_t r)
{
  return _L4_time_add_usec (l, r);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_sub_usec (l4_time_t l, l4_word_t r)
{
  return _L4_time_sub_usec (l, r);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_add (l4_time_t l, l4_time_t r)
{
  return _L4_time_add (l, r);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_time_sub (l4_time_t l, l4_time_t r)
{
  return _L4_time_sub (l, r);
}


static inline l4_time_t
_L4_attribute_always_inline
l4_is_time_longer (l4_time_t l, l4_time_t r)
{
  return _L4_is_time_longer (l, r);
}


static inline bool
_L4_attribute_always_inline
l4_is_time_shorter (l4_time_t l, l4_time_t r)
{
  return _L4_is_time_shorter (l, r);
}


static inline bool
_L4_attribute_always_inline
l4_is_time_equal (l4_time_t l, l4_time_t r)
{
  return _L4_is_time_equal (l, r);
}


static inline bool
_L4_attribute_always_inline
l4_is_time_not_equal (l4_time_t l, l4_time_t r)
{
  return _L4_is_time_not_equal (l, r);
}



static inline void
_L4_attribute_always_inline
l4_thread_switch (l4_thread_id_t thread)
{
  _L4_thread_switch (thread);
}


static inline void
_L4_attribute_always_inline
l4_yield (void)
{
  _L4_yield ();
}



/* Generic Programming Interface.  */
static inline l4_word_t
_L4_attribute_always_inline
l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
	     l4_word_t proc_control, l4_word_t prio,
	     l4_word_t preempt_control, l4_word_t *old_time_control)
{
  return _L4_schedule (dest, time_control, proc_control, prio,
		       preempt_control, old_time_control);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_set_priority (l4_thread_id_t dest, l4_word_t priority)
{
  return _L4_set_priority (dest, priority);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_set_processor_no (l4_thread_id_t dest, l4_word_t proc_num)
{
  return _L4_set_processor_no (dest, proc_num);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_time_slice (l4_thread_id_t dest, l4_time_t *ts,
				       l4_time_t *tq)
{
  return _L4_time_slice (dest, ts, tq);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_set_time_slice (l4_thread_id_t dest, l4_time_t ts, l4_time_t tq)
{
  return _L4_set_time_slice (dest, ts, tq);
}


static inline l4_word_t
_L4_attribute_always_inline
l4_set_preemption_delay (l4_thread_id_t dest, l4_word_t sensitive_prio,
			 l4_word_t max_delay)
{
  return _L4_set_preemption_delay (dest, sensitive_prio, max_delay);
}


static inline bool
_L4_attribute_always_inline
l4_enable_preemption_fault_exception (void)
{
  return _L4_enable_preemption_fault_exception ();
}


static inline bool
_L4_attribute_always_inline
l4_disable_preemption_fault_exception (void)
{
  return _L4_disable_preemption_fault_exception ();
}


static inline bool
_L4_attribute_always_inline
l4_enable_preemption (void)
{
  return _L4_enable_preemption ();
}


static inline bool
_L4_attribute_always_inline
l4_disable_preemption (void)
{
  return _L4_disable_preemption ();
}


static inline bool
_L4_attribute_always_inline
l4_preemptionpending (void)
{
  return _L4_preemption_pending ();
}