1 | /* tasks.h |
---|
2 | * |
---|
3 | * This include file contains all constants and structures associated |
---|
4 | * with RTEMS tasks. This manager provides a comprehensive set of directives |
---|
5 | * to create, delete, and administer tasks. |
---|
6 | * |
---|
7 | * Directives provided are: |
---|
8 | * |
---|
9 | * + create a task |
---|
10 | * + get an ID of a task |
---|
11 | * + start a task |
---|
12 | * + restart a task |
---|
13 | * + delete a task |
---|
14 | * + suspend a task |
---|
15 | * + resume a task |
---|
16 | * + set a task's priority |
---|
17 | * + change the current task's mode |
---|
18 | * + get a task notepad entry |
---|
19 | * + set a task notepad entry |
---|
20 | * + wake up after interval |
---|
21 | * + wake up when specified |
---|
22 | * |
---|
23 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
24 | * On-Line Applications Research Corporation (OAR). |
---|
25 | * All rights assigned to U.S. Government, 1994. |
---|
26 | * |
---|
27 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
28 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
29 | * notice must appear in all copies of this file and its derivatives. |
---|
30 | * |
---|
31 | * $Id$ |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef __RTEMS_RTEMS_TASKS_h |
---|
35 | #define __RTEMS_RTEMS_TASKS_h |
---|
36 | |
---|
37 | #ifdef __cplusplus |
---|
38 | extern "C" { |
---|
39 | #endif |
---|
40 | |
---|
41 | #include <rtems.h> |
---|
42 | #include <rtems/message.h> |
---|
43 | #include <rtems/object.h> |
---|
44 | #include <rtems/part.h> |
---|
45 | #include <rtems/region.h> |
---|
46 | #include <rtems/sem.h> |
---|
47 | #include <rtems/states.h> |
---|
48 | #include <rtems/thread.h> |
---|
49 | #include <rtems/threadq.h> |
---|
50 | |
---|
51 | /* |
---|
52 | * Constant to be used as the ID of current task |
---|
53 | */ |
---|
54 | |
---|
55 | #define RTEMS_SELF OBJECTS_ID_OF_SELF |
---|
56 | |
---|
57 | /* |
---|
58 | * This constant is passed to the rtems_task_wake_after directive as the |
---|
59 | * interval when a task wishes to yield the CPU. |
---|
60 | */ |
---|
61 | |
---|
62 | #define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT |
---|
63 | |
---|
64 | /* |
---|
65 | * rtems_task_create |
---|
66 | * |
---|
67 | * DESCRIPTION: |
---|
68 | * |
---|
69 | * This routine implements the rtems_task_create directive. The task |
---|
70 | * will have the name name. The attribute_set can be used to indicate |
---|
71 | * that the task will be globally accessible or utilize floating point. |
---|
72 | * The task's stack will be stack_size bytes. The task will begin |
---|
73 | * execution with initial_priority and initial_modes. It returns the |
---|
74 | * id of the created task in ID. |
---|
75 | */ |
---|
76 | |
---|
77 | rtems_status_code rtems_task_create( |
---|
78 | rtems_name name, |
---|
79 | rtems_task_priority initial_priority, |
---|
80 | unsigned32 stack_size, |
---|
81 | rtems_mode initial_modes, |
---|
82 | rtems_attribute attribute_set, |
---|
83 | Objects_Id *id |
---|
84 | ); |
---|
85 | |
---|
86 | /* |
---|
87 | * rtems_task_ident |
---|
88 | * |
---|
89 | * DESCRIPTION: |
---|
90 | * |
---|
91 | * This routine implements the rtems_task_ident directive. |
---|
92 | * This directive returns the task ID associated with name. |
---|
93 | * If more than one task is named name, then the task to |
---|
94 | * which the ID belongs is arbitrary. node indicates the |
---|
95 | * extent of the search for the ID of the task named name. |
---|
96 | * The search can be limited to a particular node or allowed to |
---|
97 | * encompass all nodes. |
---|
98 | */ |
---|
99 | |
---|
100 | rtems_status_code rtems_task_ident( |
---|
101 | rtems_name name, |
---|
102 | unsigned32 node, |
---|
103 | Objects_Id *id |
---|
104 | ); |
---|
105 | |
---|
106 | /* |
---|
107 | * rtems_task_delete |
---|
108 | * |
---|
109 | * DESCRIPTION: |
---|
110 | * |
---|
111 | * This routine implements the rtems_task_delete directive. The |
---|
112 | * task indicated by ID is deleted. |
---|
113 | */ |
---|
114 | |
---|
115 | rtems_status_code rtems_task_delete( |
---|
116 | Objects_Id id |
---|
117 | ); |
---|
118 | |
---|
119 | /* |
---|
120 | * rtems_task_get_note |
---|
121 | * |
---|
122 | * DESCRIPTION: |
---|
123 | * |
---|
124 | * This routine implements the rtems_task_get_note directive. The |
---|
125 | * value of the indicated notepad for the task associated with ID |
---|
126 | * is returned in note. |
---|
127 | */ |
---|
128 | |
---|
129 | rtems_status_code rtems_task_get_note( |
---|
130 | Objects_Id id, |
---|
131 | unsigned32 notepad, |
---|
132 | unsigned32 *note |
---|
133 | ); |
---|
134 | |
---|
135 | /* |
---|
136 | * rtems_task_set_note |
---|
137 | * |
---|
138 | * DESCRIPTION: |
---|
139 | * |
---|
140 | * This routine implements the rtems_task_set_note directive. The |
---|
141 | * value of the indicated notepad for the task associated with ID |
---|
142 | * is returned in note. |
---|
143 | */ |
---|
144 | |
---|
145 | rtems_status_code rtems_task_set_note( |
---|
146 | Objects_Id id, |
---|
147 | unsigned32 notepad, |
---|
148 | unsigned32 note |
---|
149 | ); |
---|
150 | |
---|
151 | /* |
---|
152 | * rtems_task_mode |
---|
153 | * |
---|
154 | * DESCRIPTION: |
---|
155 | * |
---|
156 | * This routine implements the rtems_task_mode directive. The current |
---|
157 | * values of the modes indicated by mask of the calling task are changed |
---|
158 | * to that indicated in mode_set. The former mode of the task is |
---|
159 | * returned in mode_set. |
---|
160 | */ |
---|
161 | |
---|
162 | rtems_status_code rtems_task_mode( |
---|
163 | rtems_mode mode_set, |
---|
164 | rtems_mode mask, |
---|
165 | rtems_mode *previous_mode_set |
---|
166 | ); |
---|
167 | |
---|
168 | /* |
---|
169 | * rtems_task_restart |
---|
170 | * |
---|
171 | * DESCRIPTION: |
---|
172 | * |
---|
173 | * This routine implements the rtems_task_restart directive. The |
---|
174 | * task associated with ID is restarted at its initial entry |
---|
175 | * point with the new argument. |
---|
176 | */ |
---|
177 | |
---|
178 | rtems_status_code rtems_task_restart( |
---|
179 | Objects_Id id, |
---|
180 | unsigned32 arg |
---|
181 | ); |
---|
182 | |
---|
183 | /* |
---|
184 | * rtems_task_suspend |
---|
185 | * |
---|
186 | * DESCRIPTION: |
---|
187 | * |
---|
188 | * This routine implements the rtems_task_suspend directive. The |
---|
189 | * SUSPENDED state is set for task associated with ID. |
---|
190 | */ |
---|
191 | |
---|
192 | rtems_status_code rtems_task_suspend( |
---|
193 | Objects_Id id |
---|
194 | ); |
---|
195 | |
---|
196 | /* |
---|
197 | * rtems_task_resume |
---|
198 | * |
---|
199 | * DESCRIPTION: |
---|
200 | * |
---|
201 | * This routine implements the rtems_task_resume Directive. The |
---|
202 | * SUSPENDED state is cleared for task associated with ID. |
---|
203 | */ |
---|
204 | |
---|
205 | rtems_status_code rtems_task_resume( |
---|
206 | Objects_Id id |
---|
207 | ); |
---|
208 | |
---|
209 | /* |
---|
210 | * rtems_task_set_priority |
---|
211 | * |
---|
212 | * DESCRIPTION: |
---|
213 | * |
---|
214 | * This routine implements the rtems_task_set_priority directive. The |
---|
215 | * current priority of the task associated with ID is set to |
---|
216 | * new_priority. The former priority of that task is returned |
---|
217 | * in old_priority. |
---|
218 | */ |
---|
219 | |
---|
220 | rtems_status_code rtems_task_set_priority( |
---|
221 | Objects_Id id, |
---|
222 | rtems_task_priority new_priority, |
---|
223 | rtems_task_priority *old_priority |
---|
224 | ); |
---|
225 | |
---|
226 | /* |
---|
227 | * rtems_task_start |
---|
228 | * |
---|
229 | * DESCRIPTION: |
---|
230 | * |
---|
231 | * This routine implements the rtems_task_start directive. The |
---|
232 | * starting execution point of the task associated with ID is |
---|
233 | * set to entry_point with the initial argument. |
---|
234 | */ |
---|
235 | |
---|
236 | rtems_status_code rtems_task_start( |
---|
237 | Objects_Id id, |
---|
238 | rtems_task_entry entry_point, |
---|
239 | unsigned32 argument |
---|
240 | ); |
---|
241 | |
---|
242 | /* |
---|
243 | * rtems_task_wake_when |
---|
244 | * |
---|
245 | * DESCRIPTION: |
---|
246 | * |
---|
247 | * This routine implements the rtems_task_wake_when directive. The |
---|
248 | * calling task is blocked until the current time of day is |
---|
249 | * equal to that indicated by time_buffer. |
---|
250 | */ |
---|
251 | |
---|
252 | rtems_status_code rtems_task_wake_when( |
---|
253 | rtems_time_of_day *time_buffer |
---|
254 | ); |
---|
255 | |
---|
256 | /* |
---|
257 | * rtems_task_wake_after |
---|
258 | * |
---|
259 | * DESCRIPTION: |
---|
260 | * |
---|
261 | * This routine implements the rtems_task_wake_after directive. The |
---|
262 | * calling task is blocked until the indicated number of clock |
---|
263 | * ticks have occurred. |
---|
264 | */ |
---|
265 | |
---|
266 | rtems_status_code rtems_task_wake_after( |
---|
267 | rtems_interval ticks |
---|
268 | ); |
---|
269 | |
---|
270 | /* |
---|
271 | * _RTEMS_tasks_Allocate |
---|
272 | * |
---|
273 | * DESCRIPTION: |
---|
274 | * |
---|
275 | * This function allocates a task control block from |
---|
276 | * the inactive chain of free task control blocks. |
---|
277 | */ |
---|
278 | |
---|
279 | STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void ); |
---|
280 | |
---|
281 | /* |
---|
282 | * _RTEMS_tasks_Free |
---|
283 | * |
---|
284 | * DESCRIPTION: |
---|
285 | * |
---|
286 | * This routine frees a task control block to the |
---|
287 | * inactive chain of free task control blocks. |
---|
288 | |
---|
289 | */ |
---|
290 | |
---|
291 | STATIC INLINE void _RTEMS_tasks_Free ( |
---|
292 | Thread_Control *the_task |
---|
293 | ); |
---|
294 | |
---|
295 | /* |
---|
296 | * _RTEMS_tasks_Cancel_wait |
---|
297 | * |
---|
298 | * DESCRIPTION: |
---|
299 | * |
---|
300 | * This routine unblocks the_thread and cancels any timers |
---|
301 | * which the_thread has active. |
---|
302 | */ |
---|
303 | |
---|
304 | STATIC INLINE void _RTEMS_tasks_Cancel_wait( |
---|
305 | Thread_Control *the_thread |
---|
306 | ); |
---|
307 | |
---|
308 | #include <rtems/tasks.inl> |
---|
309 | #include <rtems/taskmp.h> |
---|
310 | |
---|
311 | #ifdef __cplusplus |
---|
312 | } |
---|
313 | #endif |
---|
314 | |
---|
315 | #endif |
---|
316 | /* end of include file */ |
---|