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

4.104.114.84.95
Last change on this file since 1d496f6 was 1d496f6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/29/04 at 16:04:42

2004-03-29 Ralf Corsepius <ralf_corsepius@…>

  • rtems/include/rtems.h, rtems/include/rtems/rtems/asr.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/config.h, rtems/include/rtems/rtems/dpmem.h, rtems/include/rtems/rtems/eventset.h, rtems/include/rtems/rtems/message.h, rtems/include/rtems/rtems/modes.h, rtems/include/rtems/rtems/msgmp.h, rtems/include/rtems/rtems/options.h, rtems/include/rtems/rtems/part.h, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/region.h, rtems/include/rtems/rtems/regionmp.h, rtems/include/rtems/rtems/sem.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/inline/rtems/rtems/part.inl, rtems/inline/rtems/rtems/region.inl, rtems/macros/rtems/rtems/part.inl, rtems/src/attr.c, rtems/src/dpmem.c, rtems/src/dpmemcreate.c, rtems/src/dpmemexternal2internal.c, rtems/src/dpmeminternal2external.c, rtems/src/eventseize.c, rtems/src/msg.c, rtems/src/msgmp.c, rtems/src/msgqallocate.c, rtems/src/msgqbroadcast.c, rtems/src/msgqcreate.c, rtems/src/msgqflush.c, rtems/src/msgqgetnumberpending.c, rtems/src/msgqident.c, rtems/src/msgqreceive.c, rtems/src/msgqsend.c, rtems/src/msgqsubmit.c, rtems/src/msgqtranslatereturncode.c, rtems/src/msgqurgent.c, rtems/src/part.c, rtems/src/partcreate.c, rtems/src/partident.c, rtems/src/partmp.c, rtems/src/ratemon.c, rtems/src/region.c, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionmp.c, rtems/src/regionreturnsegment.c, rtems/src/rtemstimer.c, rtems/src/sem.c, rtems/src/semcreate.c, rtems/src/semident.c, rtems/src/semmp.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, rtems/src/taskcreate.c, rtems/src/taskgetnote.c, rtems/src/taskident.c, rtems/src/taskinitusers.c, rtems/src/taskmp.c, rtems/src/taskrestart.c, rtems/src/tasks.c, rtems/src/tasksetnote.c, rtems/src/taskstart.c, rtems/src/timerserver.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 11.2 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-1999.
24 *  On-Line Applications Research Corporation (OAR).
25 *
26 *  The license and distribution terms for this file may be
27 *  found in the file LICENSE in this distribution or at
28 *  http://www.rtems.com/license/LICENSE.
29 *
30 *  $Id$
31 */
32
33#ifndef __RTEMS_RTEMS_TASKS_h
34#define __RTEMS_RTEMS_TASKS_h
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include <rtems/score/object.h>
41#include <rtems/score/states.h>
42#include <rtems/score/thread.h>
43#include <rtems/rtems/types.h>
44#include <rtems/rtems/eventset.h>
45#include <rtems/rtems/asr.h>
46#include <rtems/rtems/attr.h>
47#include <rtems/rtems/status.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 uint32_t   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  uint32_t              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  uint32_t              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  uint32_t                 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
166RTEMS_EXTERN Objects_Information _RTEMS_tasks_Information;
167
168/*
169 *  These are used to manage the user initialization tasks.
170 */
171
172RTEMS_EXTERN rtems_initialization_tasks_table
173               *_RTEMS_tasks_User_initialization_tasks;
174RTEMS_EXTERN uint32_t     _RTEMS_tasks_Number_of_initialization_tasks;
175
176/*
177 *  _RTEMS_tasks_Manager_initialization
178 *
179 *  DESCRIPTION:
180 *
181 *  This routine initializes all Task Manager related data structures.
182 */
183 
184void _RTEMS_tasks_Manager_initialization(
185  uint32_t                          maximum_tasks,
186  uint32_t                          number_of_initialization_tasks,
187  rtems_initialization_tasks_table *user_tasks
188);
189
190/*
191 *  rtems_task_create
192 *
193 *  DESCRIPTION:
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 */
202
203rtems_status_code rtems_task_create(
204  rtems_name           name,
205  rtems_task_priority  initial_priority,
206  uint32_t             stack_size,
207  rtems_mode           initial_modes,
208  rtems_attribute      attribute_set,
209  Objects_Id          *id
210);
211
212/*
213 *  rtems_task_ident
214 *
215 *  DESCRIPTION:
216 *
217 *  This routine implements the rtems_task_ident directive.
218 *  This directive returns the task ID associated with name.
219 *  If more than one task is named name, then the task to
220 *  which the ID belongs is arbitrary.  node indicates the
221 *  extent of the search for the ID of the task named name.
222 *  The search can be limited to a particular node or allowed to
223 *  encompass all nodes.
224 */
225
226rtems_status_code rtems_task_ident(
227  rtems_name    name,
228  uint32_t      node,
229  Objects_Id   *id
230);
231
232/*
233 *  rtems_task_delete
234 *
235 *  DESCRIPTION:
236 *
237 *  This routine implements the rtems_task_delete directive.  The
238 *  task indicated by ID is deleted.
239 */
240
241rtems_status_code rtems_task_delete(
242  Objects_Id id
243);
244
245/*
246 *  rtems_task_get_note
247 *
248 *  DESCRIPTION:
249 *
250 *  This routine implements the rtems_task_get_note directive.  The
251 *  value of the indicated notepad for the task associated with ID
252 *  is returned in note.
253 */
254
255rtems_status_code rtems_task_get_note(
256  Objects_Id  id,
257  uint32_t    notepad,
258  uint32_t   *note
259);
260
261/*
262 *  rtems_task_set_note
263 *
264 *  DESCRIPTION:
265 *
266 *  This routine implements the rtems_task_set_note directive.  The
267 *  value of the indicated notepad for the task associated with ID
268 *  is returned in note.
269 */
270
271rtems_status_code rtems_task_set_note(
272  Objects_Id id,
273  uint32_t   notepad,
274  uint32_t   note
275);
276
277/*
278 *  rtems_task_mode
279 *
280 *  DESCRIPTION:
281 *
282 *  This routine implements the rtems_task_mode directive.  The current
283 *  values of the modes indicated by mask of the calling task are changed
284 *  to that indicated in mode_set.  The former mode of the task is
285 *  returned in mode_set.
286 */
287
288rtems_status_code rtems_task_mode(
289  rtems_mode  mode_set,
290  rtems_mode  mask,
291  rtems_mode *previous_mode_set
292);
293
294/*
295 *  rtems_task_restart
296 *
297 *  DESCRIPTION:
298 *
299 *  This routine implements the rtems_task_restart directive.  The
300 *  task associated with ID is restarted at its initial entry
301 *  point with the new argument.
302 */
303
304rtems_status_code rtems_task_restart(
305  Objects_Id id,
306  uint32_t   arg
307);
308
309/*
310 *  rtems_task_suspend
311 *
312 *  DESCRIPTION:
313 *
314 *  This routine implements the rtems_task_suspend directive.  The
315 *  SUSPENDED state is set for task associated with ID.
316 */
317
318rtems_status_code rtems_task_suspend(
319  Objects_Id id
320);
321
322/*
323 *  rtems_task_resume
324 *
325 *  DESCRIPTION:
326 *
327 *  This routine implements the rtems_task_resume Directive.  The
328 *  SUSPENDED state is cleared for task associated with ID.
329 */
330
331rtems_status_code rtems_task_resume(
332  Objects_Id id
333);
334
335/*
336 *  rtems_task_set_priority
337 *
338 *  DESCRIPTION:
339 *
340 *  This routine implements the rtems_task_set_priority directive.  The
341 *  current priority of the task associated with ID is set to
342 *  new_priority.  The former priority of that task is returned
343 *  in old_priority.
344 */
345
346rtems_status_code rtems_task_set_priority(
347  Objects_Id           id,
348  rtems_task_priority  new_priority,
349  rtems_task_priority *old_priority
350);
351
352/*
353 *  rtems_task_start
354 *
355 *  DESCRIPTION:
356 *
357 *  This routine implements the rtems_task_start directive.  The
358 *  starting execution point of the task associated with ID is
359 *  set to entry_point with the initial argument.
360 */
361
362rtems_status_code rtems_task_start(
363  Objects_Id   id,
364  rtems_task_entry entry_point,
365  uint32_t     argument
366);
367
368/*
369 *  rtems_task_wake_when
370 *
371 *  DESCRIPTION:
372 *
373 *  This routine implements the rtems_task_wake_when directive.  The
374 *  calling task is blocked until the current time of day is
375 *  equal to that indicated by time_buffer.
376 */
377
378rtems_status_code rtems_task_wake_when(
379  rtems_time_of_day *time_buffer
380);
381
382/*
383 *  rtems_task_wake_after
384 *
385 *  DESCRIPTION:
386 *
387 *  This routine implements the rtems_task_wake_after directive.  The
388 *  calling task is blocked until the indicated number of clock
389 *  ticks have occurred.
390 */
391
392rtems_status_code rtems_task_wake_after(
393  rtems_interval  ticks
394);
395
396/*
397 *  rtems_task_is_suspended
398 *
399 *  This directive returns a status indicating whether or not
400 *  the specified task is suspended.
401 */
402
403rtems_status_code rtems_task_is_suspended(
404  Objects_Id id
405);
406
407/*
408 *  rtems_task_variable_add
409 *
410 *  This directive adds a per task variable.
411 */
412
413rtems_status_code rtems_task_variable_add(
414  rtems_id  tid,
415  void    **ptr,
416  void    (*dtor)(void *)
417);
418
419/*
420 *  rtems_task_variable_get
421 *
422 *  This directive gets the value of a task variable.
423 */
424
425rtems_status_code rtems_task_variable_get(
426  rtems_id tid,
427  void **ptr,
428  void **result
429);
430
431/*
432 *  rtems_task_variable_delete
433 *
434 *  This directive removes a per task variable.
435 */
436
437rtems_status_code rtems_task_variable_delete(
438  rtems_id  tid,
439  void    **ptr
440);
441
442/*
443 *  _RTEMS_tasks_Initialize_user_tasks
444 *
445 *  This routine creates and starts all configured user
446 *  initialzation threads.
447 *
448 *  Input parameters: NONE
449 *
450 *  Output parameters:  NONE
451 */
452 
453void _RTEMS_tasks_Initialize_user_tasks( void );
454
455#ifndef __RTEMS_APPLICATION__
456#include <rtems/rtems/tasks.inl>
457#endif
458#if defined(RTEMS_MULTIPROCESSING)
459#include <rtems/rtems/taskmp.h>
460#endif
461
462#ifdef __cplusplus
463}
464#endif
465
466#endif
467/* end of include file */
Note: See TracBrowser for help on using the repository browser.