source: rtems/cpukit/rtems/include/rtems/rtems/tasksimpl.h @ c52568d

5
Last change on this file since c52568d was c52568d, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:17:52

basdefs.h: Add and use RTEMS_DEPRECATED

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicTasksImpl
5 *
6 * @brief Classic Tasks Manager Implementation
7 */
8
9/*  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#ifndef _RTEMS_RTEMS_TASKSIMPL_H
18#define _RTEMS_RTEMS_TASKSIMPL_H
19
20#include <rtems/rtems/tasks.h>
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/threadimpl.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @defgroup ClassicTasksImpl Classic Tasks Manager Implementation
30 *
31 * @ingroup ClassicTasks
32 *
33 * @{
34 */
35
36/**
37 *  @brief Instantiate RTEMS Classic API Tasks Data
38 *
39 *  This constant is defined to extern most of the time when using
40 *  this header file.  However by defining it to nothing, the data
41 *  declared in this header file can be instantiated.  This is done
42 *  in a single per manager file.
43 */
44#ifndef RTEMS_TASKS_EXTERN
45#define RTEMS_TASKS_EXTERN extern
46#endif
47
48/**
49 *  The following instantiates the information control block used to
50 *  manage this class of objects.
51 */
52RTEMS_TASKS_EXTERN Thread_Information _RTEMS_tasks_Information;
53
54/**
55 *  @brief RTEMS Task Manager Initialization
56 *
57 *  This routine initializes all Task Manager related data structures.
58 */
59void _RTEMS_tasks_Manager_initialization(void);
60
61/**
62 *  @brief RTEMS User Task Initialization
63 *
64 *  This routine creates and starts all configured user
65 *  initialization threads.
66 */
67void _RTEMS_tasks_Initialize_user_tasks( void );
68
69#if !defined(RTEMS_SMP)
70/**
71 *  @brief RTEMS Tasks Invoke Task Variable Destructor
72 *
73 *  @deprecated Task variables are deprecated.
74 *
75 *  This routine invokes the optional user provided destructor on the
76 *  task variable and frees the memory for the task variable.
77 */
78void _RTEMS_Tasks_Invoke_task_variable_dtor(
79  Thread_Control        *the_thread,
80  rtems_task_variable_t *tvp
81) RTEMS_DEPRECATED;
82#endif
83
84RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate(void)
85{
86  _Objects_Allocator_lock();
87
88  _Thread_Kill_zombies();
89
90  return (Thread_Control *)
91    _Objects_Allocate_unprotected( &_RTEMS_tasks_Information.Objects );
92}
93
94/**
95 *  @brief Frees a task control block.
96 *
97 *  This routine frees a task control block to the
98 *  inactive chain of free task control blocks.
99 */
100RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free (
101  Thread_Control *the_task
102)
103{
104  _Objects_Free(
105    _Objects_Get_information_id( the_task->Object.id ),
106    &the_task->Object
107  );
108}
109
110/**
111 *  @brief Converts an RTEMS API priority into a core priority.
112 *
113 *  This function converts an RTEMS API priority into a core priority.
114 */
115RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core(
116  rtems_task_priority   priority
117)
118{
119  return (Priority_Control) priority;
120}
121
122/**
123 *  @brief Converts a core priority into an RTEMS API priority.
124 *
125 *  This function converts a core priority into an RTEMS API priority.
126 */
127RTEMS_INLINE_ROUTINE rtems_task_priority _RTEMS_tasks_Priority_from_Core (
128  Priority_Control priority
129)
130{
131  return (rtems_task_priority) priority;
132}
133
134/**
135 *  @brief Checks whether the priority is a valid user task.
136 *
137 *  This function returns TRUE if the_priority is a valid user task priority
138 *  and FALSE otherwise.
139 */
140RTEMS_INLINE_ROUTINE bool _RTEMS_tasks_Priority_is_valid (
141  rtems_task_priority the_priority
142)
143{
144  return (  ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
145            ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
146}
147
148/**@}*/
149
150#if defined(RTEMS_MULTIPROCESSING)
151#include <rtems/rtems/taskmp.h>
152#endif
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif
159/* end of include file */
Note: See TracBrowser for help on using the repository browser.