source: rtems/cpukit/rtems/include/rtems/rtems/tasks.h @ 1a8fde6c

4.104.114.84.95
Last change on this file since 1a8fde6c was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

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