source: rtems/cpukit/rtems/include/rtems/rtems/tasks.h @ 97e2729d

4.104.114.84.95
Last change on this file since 97e2729d was 97e2729d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 17:38:09

Added --disable-multiprocessing flag and modified a lot of files to make
it work.

  • Property mode set to 100644
File size: 10.5 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-1998.
24 *  On-Line Applications Research Corporation (OAR).
25 *  Copyright assigned to U.S. Government, 1994.
26 *
27 *  The license and distribution terms for this file may be
28 *  found in the file LICENSE in this distribution or at
29 *  http://www.OARcorp.com/rtems/license.html.
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/score/object.h>
42#include <rtems/score/states.h>
43#include <rtems/score/thread.h>
44#include <rtems/rtems/types.h>
45#include <rtems/rtems/eventset.h>
46#include <rtems/rtems/asr.h>
47#include <rtems/rtems/attr.h>
48#include <rtems/rtems/status.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 WATCHDOG_NO_TIMEOUT
62
63/*
64 *  Define the type for an RTEMS API task priority.
65 */
66
67typedef Priority_Control rtems_task_priority;
68
69#define RTEMS_NO_PRIORITY           RTEMS_CURRENT_PRIORITY
70
71#define RTEMS_MINIMUM_PRIORITY      (PRIORITY_MINIMUM + 1)
72#define RTEMS_MAXIMUM_PRIORITY      PRIORITY_MAXIMUM
73
74/*
75 *  The following constant is passed to rtems_task_set_priority when the
76 *  caller wants to obtain the current priority.
77 */
78
79#define RTEMS_CURRENT_PRIORITY      PRIORITY_MINIMUM   
80
81/*
82 *  Notepads constants (indices into notepad array)
83 */
84 
85#define RTEMS_NOTEPAD_FIRST 0             /* lowest numbered notepad */
86#define RTEMS_NOTEPAD_0    0              /* notepad location 0  */
87#define RTEMS_NOTEPAD_1    1              /* notepad location 1  */
88#define RTEMS_NOTEPAD_2    2              /* notepad location 2  */
89#define RTEMS_NOTEPAD_3    3              /* notepad location 3  */
90#define RTEMS_NOTEPAD_4    4              /* notepad location 4  */
91#define RTEMS_NOTEPAD_5    5              /* notepad location 5  */
92#define RTEMS_NOTEPAD_6    6              /* notepad location 6  */
93#define RTEMS_NOTEPAD_7    7              /* notepad location 7  */
94#define RTEMS_NOTEPAD_8    8              /* notepad location 8  */
95#define RTEMS_NOTEPAD_9    9              /* notepad location 9  */
96#define RTEMS_NOTEPAD_10   10             /* notepad location 10 */
97#define RTEMS_NOTEPAD_11   11             /* notepad location 11 */
98#define RTEMS_NOTEPAD_12   12             /* notepad location 12 */
99#define RTEMS_NOTEPAD_13   13             /* notepad location 13 */
100#define RTEMS_NOTEPAD_14   14             /* notepad location 14 */
101#define RTEMS_NOTEPAD_15   15             /* notepad location 15 */
102#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15     /* highest numbered notepad */
103 
104#define RTEMS_NUMBER_NOTEPADS  (RTEMS_NOTEPAD_LAST+1)
105
106/*
107 *  External API name for Thread_Control
108 */
109
110typedef Thread_Control rtems_tcb;
111
112/*
113 *  The following defines the "return type" of an RTEMS task.
114 */
115 
116typedef void rtems_task;
117
118/*
119 *  The following defines the argument to an RTEMS task.
120 */
121 
122typedef unsigned32 rtems_task_argument;
123
124/*
125 *  The following defines the type for the entry point of an RTEMS task.
126 */
127 
128typedef rtems_task ( *rtems_task_entry )(
129                      rtems_task_argument
130                   );
131 
132/*
133 *  The following records define the Initialization Tasks Table.
134 *  Each entry contains the information required by RTEMS to
135 *  create and start a user task automatically at executive
136 *  initialization time.
137 */
138 
139typedef struct {
140  rtems_name            name;              /* task name */
141  unsigned32            stack_size;        /* task stack size */
142  rtems_task_priority   initial_priority;  /* task priority */
143  rtems_attribute       attribute_set;     /* task attributes */
144  rtems_task_entry      entry_point;       /* task entry point */
145  rtems_mode            mode_set;          /* task initial mode */
146  unsigned32            argument;          /* task argument */
147} rtems_initialization_tasks_table;
148
149/*
150 *  This is the API specific information required by each thread for
151 *  the RTEMS API to function correctly.
152 */
153
154 
155typedef struct {
156  unsigned32                Notepads[ RTEMS_NUMBER_NOTEPADS ];
157  rtems_event_set           pending_events;
158  rtems_event_set           event_condition;
159  ASR_Information           Signal;
160}  RTEMS_API_Control;
161
162/*
163 *  The following defines the information control block used to
164 *  manage this class of objects.
165 */
166
167RTEMS_EXTERN Objects_Information _RTEMS_tasks_Information;
168
169/*
170 *  These are used to manage the user initialization tasks.
171 */
172
173RTEMS_EXTERN rtems_initialization_tasks_table
174               *_RTEMS_tasks_User_initialization_tasks;
175RTEMS_EXTERN unsigned32   _RTEMS_tasks_Number_of_initialization_tasks;
176
177/*
178 *  _RTEMS_tasks_Manager_initialization
179 *
180 *  DESCRIPTION:
181 *
182 *  This routine initializes all Task Manager related data structures.
183 */
184 
185void _RTEMS_tasks_Manager_initialization(
186  unsigned32                        maximum_tasks,
187  unsigned32                        number_of_initialization_tasks,
188  rtems_initialization_tasks_table *user_tasks
189);
190
191/*
192 *  rtems_task_create
193 *
194 *  DESCRIPTION:
195 *
196 *  This routine implements the rtems_task_create directive.  The task
197 *  will have the name name.  The attribute_set can be used to indicate
198 *  that the task will be globally accessible or utilize floating point.
199 *  The task's stack will be stack_size bytes.   The task will begin
200 *  execution with initial_priority and initial_modes.  It returns the
201 *  id of the created task in ID.
202 */
203
204rtems_status_code rtems_task_create(
205  rtems_name           name,
206  rtems_task_priority  initial_priority,
207  unsigned32           stack_size,
208  rtems_mode           initial_modes,
209  rtems_attribute      attribute_set,
210  Objects_Id          *id
211);
212
213/*
214 *  rtems_task_ident
215 *
216 *  DESCRIPTION:
217 *
218 *  This routine implements the rtems_task_ident directive.
219 *  This directive returns the task ID associated with name.
220 *  If more than one task is named name, then the task to
221 *  which the ID belongs is arbitrary.  node indicates the
222 *  extent of the search for the ID of the task named name.
223 *  The search can be limited to a particular node or allowed to
224 *  encompass all nodes.
225 */
226
227rtems_status_code rtems_task_ident(
228  rtems_name    name,
229  unsigned32    node,
230  Objects_Id   *id
231);
232
233/*
234 *  rtems_task_delete
235 *
236 *  DESCRIPTION:
237 *
238 *  This routine implements the rtems_task_delete directive.  The
239 *  task indicated by ID is deleted.
240 */
241
242rtems_status_code rtems_task_delete(
243  Objects_Id id
244);
245
246/*
247 *  rtems_task_get_note
248 *
249 *  DESCRIPTION:
250 *
251 *  This routine implements the rtems_task_get_note directive.  The
252 *  value of the indicated notepad for the task associated with ID
253 *  is returned in note.
254 */
255
256rtems_status_code rtems_task_get_note(
257  Objects_Id  id,
258  unsigned32  notepad,
259  unsigned32 *note
260);
261
262/*
263 *  rtems_task_set_note
264 *
265 *  DESCRIPTION:
266 *
267 *  This routine implements the rtems_task_set_note directive.  The
268 *  value of the indicated notepad for the task associated with ID
269 *  is returned in note.
270 */
271
272rtems_status_code rtems_task_set_note(
273  Objects_Id id,
274  unsigned32 notepad,
275  unsigned32 note
276);
277
278/*
279 *  rtems_task_mode
280 *
281 *  DESCRIPTION:
282 *
283 *  This routine implements the rtems_task_mode directive.  The current
284 *  values of the modes indicated by mask of the calling task are changed
285 *  to that indicated in mode_set.  The former mode of the task is
286 *  returned in mode_set.
287 */
288
289rtems_status_code rtems_task_mode(
290  rtems_mode  mode_set,
291  rtems_mode  mask,
292  rtems_mode *previous_mode_set
293);
294
295/*
296 *  rtems_task_restart
297 *
298 *  DESCRIPTION:
299 *
300 *  This routine implements the rtems_task_restart directive.  The
301 *  task associated with ID is restarted at its initial entry
302 *  point with the new argument.
303 */
304
305rtems_status_code rtems_task_restart(
306  Objects_Id id,
307  unsigned32 arg
308);
309
310/*
311 *  rtems_task_suspend
312 *
313 *  DESCRIPTION:
314 *
315 *  This routine implements the rtems_task_suspend directive.  The
316 *  SUSPENDED state is set for task associated with ID.
317 */
318
319rtems_status_code rtems_task_suspend(
320  Objects_Id id
321);
322
323/*
324 *  rtems_task_resume
325 *
326 *  DESCRIPTION:
327 *
328 *  This routine implements the rtems_task_resume Directive.  The
329 *  SUSPENDED state is cleared for task associated with ID.
330 */
331
332rtems_status_code rtems_task_resume(
333  Objects_Id id
334);
335
336/*
337 *  rtems_task_set_priority
338 *
339 *  DESCRIPTION:
340 *
341 *  This routine implements the rtems_task_set_priority directive.  The
342 *  current priority of the task associated with ID is set to
343 *  new_priority.  The former priority of that task is returned
344 *  in old_priority.
345 */
346
347rtems_status_code rtems_task_set_priority(
348  Objects_Id           id,
349  rtems_task_priority  new_priority,
350  rtems_task_priority *old_priority
351);
352
353/*
354 *  rtems_task_start
355 *
356 *  DESCRIPTION:
357 *
358 *  This routine implements the rtems_task_start directive.  The
359 *  starting execution point of the task associated with ID is
360 *  set to entry_point with the initial argument.
361 */
362
363rtems_status_code rtems_task_start(
364  Objects_Id   id,
365  rtems_task_entry entry_point,
366  unsigned32   argument
367);
368
369/*
370 *  rtems_task_wake_when
371 *
372 *  DESCRIPTION:
373 *
374 *  This routine implements the rtems_task_wake_when directive.  The
375 *  calling task is blocked until the current time of day is
376 *  equal to that indicated by time_buffer.
377 */
378
379rtems_status_code rtems_task_wake_when(
380  rtems_time_of_day *time_buffer
381);
382
383/*
384 *  rtems_task_wake_after
385 *
386 *  DESCRIPTION:
387 *
388 *  This routine implements the rtems_task_wake_after directive.  The
389 *  calling task is blocked until the indicated number of clock
390 *  ticks have occurred.
391 */
392
393rtems_status_code rtems_task_wake_after(
394  rtems_interval  ticks
395);
396
397/*PAGE
398 *
399 *  _RTEMS_tasks_Initialize_user_tasks
400 *
401 *  This routine creates and starts all configured user
402 *  initialzation threads.
403 *
404 *  Input parameters: NONE
405 *
406 *  Output parameters:  NONE
407 */
408 
409void _RTEMS_tasks_Initialize_user_tasks( void );
410
411#ifndef __RTEMS_APPLICATION__
412#include <rtems/rtems/tasks.inl>
413#endif
414#if defined(RTEMS_MULTIPROCESSING)
415#include <rtems/rtems/taskmp.h>
416#endif
417
418#ifdef __cplusplus
419}
420#endif
421
422#endif
423/* end of include file */
Note: See TracBrowser for help on using the repository browser.