source: rtems/cpukit/rtems/include/rtems/rtems/tasks.h @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

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