source: rtems/cpukit/rtems/include/rtems/rtems/tasks.h @ 067a96a

4.104.114.95
Last change on this file since 067a96a was 067a96a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/18/08 at 15:02:20

2008-04-18 Joel Sherrill <joel.sherrill@…>

  • rtems/include/rtems.h, rtems/include/rtems/rtems/asr.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/barriermp.h, rtems/include/rtems/rtems/cache.h, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/config.h, rtems/include/rtems/rtems/dpmem.h, rtems/include/rtems/rtems/event.h, rtems/include/rtems/rtems/eventmp.h, rtems/include/rtems/rtems/eventset.h, rtems/include/rtems/rtems/intr.h, rtems/include/rtems/rtems/message.h, rtems/include/rtems/rtems/modes.h, rtems/include/rtems/rtems/mp.h, rtems/include/rtems/rtems/msgmp.h, rtems/include/rtems/rtems/object.h, rtems/include/rtems/rtems/options.h, rtems/include/rtems/rtems/part.h, rtems/include/rtems/rtems/partmp.h, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/region.h, rtems/include/rtems/rtems/regionmp.h, rtems/include/rtems/rtems/rtemsapi.h, rtems/include/rtems/rtems/sem.h, rtems/include/rtems/rtems/semmp.h, rtems/include/rtems/rtems/signal.h, rtems/include/rtems/rtems/signalmp.h, rtems/include/rtems/rtems/status.h, rtems/include/rtems/rtems/support.h, rtems/include/rtems/rtems/taskmp.h, rtems/include/rtems/rtems/tasks.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/inline/rtems/rtems/asr.inl, rtems/inline/rtems/rtems/attr.inl, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/dpmem.inl, rtems/inline/rtems/rtems/event.inl, rtems/inline/rtems/rtems/eventset.inl, rtems/inline/rtems/rtems/message.inl, rtems/inline/rtems/rtems/modes.inl, rtems/inline/rtems/rtems/options.inl, rtems/inline/rtems/rtems/part.inl, rtems/inline/rtems/rtems/ratemon.inl, rtems/inline/rtems/rtems/region.inl, rtems/inline/rtems/rtems/sem.inl, rtems/inline/rtems/rtems/status.inl, rtems/inline/rtems/rtems/support.inl, rtems/inline/rtems/rtems/tasks.inl, rtems/inline/rtems/rtems/timer.inl: Initial conversion of Classic API header files to Doxygen.
  • rtems/Doxyfile: New file.
  • Property mode set to 100644
File size: 11.7 KB
Line 
1/**
2 * @file rtems/rtems/tasks.h
3 *
4 *  This include file contains all constants and structures associated
5 *  with RTEMS tasks.  This manager provides a comprehensive set of directives
6 *  to create, delete, and administer tasks.
7 *
8 *  Directives provided are:
9 *
10 *     - create a task
11 *     - get an ID of a task
12 *     - start a task
13 *     - restart a task
14 *     - delete a task
15 *     - suspend a task
16 *     - resume a task
17 *     - set a task's priority
18 *     - change the current task's mode
19 *     - get a task notepad entry
20 *     - set a task notepad entry
21 *     - wake up after interval
22 *     - wake up when specified
23 */
24
25/*  COPYRIGHT (c) 1989-2007.
26 *  On-Line Applications Research Corporation (OAR).
27 *
28 *  The license and distribution terms for this file may be
29 *  found in the file LICENSE in this distribution or at
30 *  http://www.rtems.com/license/LICENSE.
31 *
32 *  $Id$
33 */
34
35#ifndef _RTEMS_RTEMS_TASKS_H
36#define _RTEMS_RTEMS_TASKS_H
37
38#include <rtems/score/object.h>
39#include <rtems/score/states.h>
40#include <rtems/score/thread.h>
41#include <rtems/rtems/types.h>
42#include <rtems/rtems/eventset.h>
43#include <rtems/rtems/asr.h>
44#include <rtems/rtems/attr.h>
45#include <rtems/rtems/status.h>
46
47#ifndef RTEMS_TASKS_EXTERN
48#define RTEMS_TASKS_EXTERN extern
49#endif
50
51/**
52 *  @defgroup ClassicTasks Classic API Tasks
53 *
54 *  This encapsulates functionality which X XX
55 */
56/**@{*/
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62/**
63 *  Constant to be used as the ID of current task
64 */
65#define RTEMS_SELF                OBJECTS_ID_OF_SELF
66
67/**
68 *  This constant is passed to the rtems_task_wake_after directive as the
69 *  interval when a task wishes to yield the CPU.
70 */
71#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
72
73/**
74 *  Define the type for an RTEMS API task priority.
75 */
76typedef Priority_Control rtems_task_priority;
77
78#define RTEMS_NO_PRIORITY           RTEMS_CURRENT_PRIORITY
79
80#define RTEMS_MINIMUM_PRIORITY      (PRIORITY_MINIMUM + 1)
81#define RTEMS_MAXIMUM_PRIORITY      PRIORITY_MAXIMUM
82
83/**
84 *  The following constant is passed to rtems_task_set_priority when the
85 *  caller wants to obtain the current priority.
86 */
87#define RTEMS_CURRENT_PRIORITY      PRIORITY_MINIMUM
88
89/** This is used to indicate the lowest numbered notepad */
90#define RTEMS_NOTEPAD_FIRST 0
91/** This is used to indicate the notepad location 0. */
92#define RTEMS_NOTEPAD_0    0
93/** This is used to indicate the notepad location 1. */
94#define RTEMS_NOTEPAD_1    1
95/** This is used to indicate the notepad location 2. */
96#define RTEMS_NOTEPAD_2    2
97/** This is used to indicate the notepad location 3. */
98#define RTEMS_NOTEPAD_3    3
99/** This is used to indicate the notepad location 4. */
100#define RTEMS_NOTEPAD_4    4
101/** This is used to indicate the notepad location 5. */
102#define RTEMS_NOTEPAD_5    5
103/** This is used to indicate the notepad location 6. */
104#define RTEMS_NOTEPAD_6    6
105/** This is used to indicate the notepad location 7. */
106#define RTEMS_NOTEPAD_7    7
107/** This is used to indicate the notepad location 8. */
108#define RTEMS_NOTEPAD_8    8
109/** This is used to indicate the notepad location 9. */
110#define RTEMS_NOTEPAD_9    9
111/** This is used to indicate the notepad location 10. */
112#define RTEMS_NOTEPAD_10   10
113/** This is used to indicate the notepad location 11. */
114#define RTEMS_NOTEPAD_11   11
115/** This is used to indicate the notepad location 12. */
116#define RTEMS_NOTEPAD_12   12
117/** This is used to indicate the notepad location 13. */
118#define RTEMS_NOTEPAD_13   13
119/** This is used to indicate the notepad location 14. */
120#define RTEMS_NOTEPAD_14   14
121/** This is used to indicate the notepad location 15. */
122#define RTEMS_NOTEPAD_15   15
123/** This is used to indicate the highest numbered notepad. */
124#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15
125
126#define RTEMS_NUMBER_NOTEPADS  (RTEMS_NOTEPAD_LAST+1)
127
128/**
129 *  External API name for Thread_Control
130 */
131typedef Thread_Control rtems_tcb;
132
133/**
134 *  The following defines the "return type" of an RTEMS task.
135 */
136typedef void rtems_task;
137
138/**
139 *  The following defines the argument to an RTEMS task.
140 */
141typedef uintptr_t   rtems_task_argument;
142
143/**
144 *  The following defines the type for the entry point of an RTEMS task.
145 */
146typedef rtems_task ( *rtems_task_entry )(
147                      rtems_task_argument
148                   );
149
150/**
151 *  The following records define the Initialization Tasks Table.
152 *  Each entry contains the information required by RTEMS to
153 *  create and start a user task automatically at executive
154 *  initialization time.
155 */
156typedef struct {
157  rtems_name            name;              /* task name */
158  size_t                stack_size;        /* task stack size */
159  rtems_task_priority   initial_priority;  /* task priority */
160  rtems_attribute       attribute_set;     /* task attributes */
161  rtems_task_entry      entry_point;       /* task entry point */
162  rtems_mode            mode_set;          /* task initial mode */
163  rtems_task_argument   argument;          /* task argument */
164} rtems_initialization_tasks_table;
165
166/**
167 *  This is the API specific information required by each thread for
168 *  the RTEMS API to function correctly.
169 */
170typedef struct {
171  uint32_t                 Notepads[ RTEMS_NUMBER_NOTEPADS ];
172  rtems_event_set          pending_events;
173  rtems_event_set          event_condition;
174  ASR_Information          Signal;
175}  RTEMS_API_Control;
176
177/*
178 *  The following defines the information control block used to
179 *  manage this class of objects.
180 */
181RTEMS_TASKS_EXTERN Objects_Information _RTEMS_tasks_Information;
182
183/**
184 *  @brief _RTEMS_tasks_Manager_initialization
185 *
186 *  This routine initializes all Task Manager related data structures.
187 */
188void _RTEMS_tasks_Manager_initialization(
189  uint32_t     maximum_tasks
190);
191
192/**
193 *  @brief rtems_task_create
194 *
195 *  This routine implements the rtems_task_create directive.  The task
196 *  will have the name name.  The attribute_set can be used to indicate
197 *  that the task will be globally accessible or utilize floating point.
198 *  The task's stack will be stack_size bytes.   The task will begin
199 *  execution with initial_priority and initial_modes.  It returns the
200 *  id of the created task in ID.
201 */
202rtems_status_code rtems_task_create(
203  rtems_name           name,
204  rtems_task_priority  initial_priority,
205  size_t               stack_size,
206  rtems_mode           initial_modes,
207  rtems_attribute      attribute_set,
208  Objects_Id          *id
209);
210
211/**
212 *  @brief rtems_task_ident
213 *
214 *  This routine implements the rtems_task_ident directive.
215 *  This directive returns the task ID associated with name.
216 *  If more than one task is named name, then the task to
217 *  which the ID belongs is arbitrary.  node indicates the
218 *  extent of the search for the ID of the task named name.
219 *  The search can be limited to a particular node or allowed to
220 *  encompass all nodes.
221 */
222rtems_status_code rtems_task_ident(
223  rtems_name    name,
224  uint32_t      node,
225  Objects_Id   *id
226);
227
228/**
229 *  @brief rtems_task_delete
230 *
231 *  This routine implements the rtems_task_delete directive.  The
232 *  task indicated by ID is deleted.
233 */
234rtems_status_code rtems_task_delete(
235  Objects_Id id
236);
237
238/**
239 *  @brief rtems_task_get_note
240 *
241 *  This routine implements the rtems_task_get_note directive.  The
242 *  value of the indicated notepad for the task associated with ID
243 *  is returned in note.
244 */
245rtems_status_code rtems_task_get_note(
246  Objects_Id  id,
247  uint32_t    notepad,
248  uint32_t   *note
249);
250
251/**
252 *  @brief rtems_task_set_note
253 *
254 *  This routine implements the rtems_task_set_note directive.  The
255 *  value of the indicated notepad for the task associated with ID
256 *  is returned in note.
257 */
258rtems_status_code rtems_task_set_note(
259  Objects_Id id,
260  uint32_t   notepad,
261  uint32_t   note
262);
263
264/**
265 *  @brief rtems_task_mode
266 *
267 *  This routine implements the rtems_task_mode directive.  The current
268 *  values of the modes indicated by mask of the calling task are changed
269 *  to that indicated in mode_set.  The former mode of the task is
270 *  returned in mode_set.
271 */
272rtems_status_code rtems_task_mode(
273  rtems_mode  mode_set,
274  rtems_mode  mask,
275  rtems_mode *previous_mode_set
276);
277
278/**
279 *  @brief rtems_task_restart
280 *
281 *  This routine implements the rtems_task_restart directive.  The
282 *  task associated with ID is restarted at its initial entry
283 *  point with the new argument.
284 */
285rtems_status_code rtems_task_restart(
286  Objects_Id id,
287  uint32_t   arg
288);
289
290/**
291 *  @brief rtems_task_suspend
292 *
293 *  This routine implements the rtems_task_suspend directive.  The
294 *  SUSPENDED state is set for task associated with ID.
295 */
296rtems_status_code rtems_task_suspend(
297  Objects_Id id
298);
299
300/**
301 *  @brief rtems_task_resume
302 *
303 *  This routine implements the rtems_task_resume Directive.  The
304 *  SUSPENDED state is cleared for task associated with ID.
305 */
306rtems_status_code rtems_task_resume(
307  Objects_Id id
308);
309
310/**
311 *  @brief rtems_task_set_priority
312 *
313 *  This routine implements the rtems_task_set_priority directive.  The
314 *  current priority of the task associated with ID is set to
315 *  new_priority.  The former priority of that task is returned
316 *  in old_priority.
317 */
318rtems_status_code rtems_task_set_priority(
319  Objects_Id           id,
320  rtems_task_priority  new_priority,
321  rtems_task_priority *old_priority
322);
323
324/**
325 *  @brief rtems_task_start
326 *
327 *  This routine implements the rtems_task_start directive.  The
328 *  starting execution point of the task associated with ID is
329 *  set to entry_point with the initial argument.
330 */
331rtems_status_code rtems_task_start(
332  Objects_Id   id,
333  rtems_task_entry entry_point,
334  rtems_task_argument     argument
335);
336
337/**
338 *  @brief rtems_task_wake_when
339 *
340 *  This routine implements the rtems_task_wake_when directive.  The
341 *  calling task is blocked until the current time of day is
342 *  equal to that indicated by time_buffer.
343 */
344rtems_status_code rtems_task_wake_when(
345  rtems_time_of_day *time_buffer
346);
347
348/**
349 *  @brief rtems_task_wake_after
350 *
351 *  This routine implements the rtems_task_wake_after directive.  The
352 *  calling task is blocked until the indicated number of clock
353 *  ticks have occurred.
354 */
355rtems_status_code rtems_task_wake_after(
356  rtems_interval  ticks
357);
358
359/**
360 *  @brief rtems_task_is_suspended
361 
362 *  This directive returns a status indicating whether or not
363 *  the specified task is suspended.
364 */
365rtems_status_code rtems_task_is_suspended(
366  Objects_Id id
367);
368
369/**
370 *  @brief rtems_task_variable_add
371 *
372 *  This directive adds a per task variable.
373 */
374rtems_status_code rtems_task_variable_add(
375  rtems_id  tid,
376  void    **ptr,
377  void    (*dtor)(void *)
378);
379
380/**
381 *  @brief rtems_task_variable_get
382 *
383 *  This directive gets the value of a task variable.
384 */
385rtems_status_code rtems_task_variable_get(
386  rtems_id tid,
387  void **ptr,
388  void **result
389);
390
391/**
392 *  @brief rtems_task_variable_delete
393 *
394 *  This directive removes a per task variable.
395 */
396rtems_status_code rtems_task_variable_delete(
397  rtems_id  tid,
398  void    **ptr
399);
400
401/**
402 *  @brief rtems_task_self
403 *
404 *  This directive returns the ID of the currently executing task.
405 */
406rtems_id rtems_task_self(void);
407
408/**
409 *  @brief _RTEMS_tasks_Initialize_user_tasks
410 *
411 *  This routine creates and starts all configured user
412 *  initialzation threads.
413 *
414 *  Input parameters: NONE
415 *
416 *  Output parameters:  NONE
417 */
418void _RTEMS_tasks_Initialize_user_tasks( void );
419
420/**
421 *  @brief _RTEMS_Tasks_Invoke_task_variable_dtor(
422 *
423 *  This routine invokes the optional user provided destructor on the
424 *  task variable and frees the memory for the task variable.
425 *
426 *  Input parameters: NONE
427 *
428 *  Output parameters:  NONE
429 */
430void _RTEMS_Tasks_Invoke_task_variable_dtor(
431  Thread_Control        *the_thread,
432  rtems_task_variable_t *tvp
433);
434
435#ifndef __RTEMS_APPLICATION__
436#include <rtems/rtems/tasks.inl>
437#endif
438#if defined(RTEMS_MULTIPROCESSING)
439#include <rtems/rtems/taskmp.h>
440#endif
441
442#ifdef __cplusplus
443}
444#endif
445
446/**@}*/
447
448#endif
449/* end of include file */
Note: See TracBrowser for help on using the repository browser.