1 | /* |
---|
2 | * The license and distribution terms for this file may be |
---|
3 | * found in the file LICENSE in this distribution or at |
---|
4 | * http://www.OARcorp.com/rtems/license.html. |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef __ITRON_TASK_inl_ |
---|
10 | #define __ITRON_TASK_inl_ |
---|
11 | |
---|
12 | #ifdef __cplusplus |
---|
13 | extern "C" { |
---|
14 | #endif |
---|
15 | |
---|
16 | /* |
---|
17 | * _ITRON_Task_Allocate |
---|
18 | * |
---|
19 | * DESCRIPTION: |
---|
20 | * |
---|
21 | * This routine allocates the task associated with the specified |
---|
22 | * task ID from the pool of inactive tasks. |
---|
23 | * |
---|
24 | * Input parameters: |
---|
25 | * tskid - id of task to allocate |
---|
26 | * status - pointer to status variable |
---|
27 | * |
---|
28 | * Output parameters: |
---|
29 | * returns - pointer to the task control block |
---|
30 | * *status - status |
---|
31 | */ |
---|
32 | |
---|
33 | RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Allocate( |
---|
34 | ID tskid |
---|
35 | ) |
---|
36 | { |
---|
37 | return (Thread_Control *)_ITRON_Objects_Allocate_by_index( |
---|
38 | &_ITRON_Task_Information, |
---|
39 | tskid, |
---|
40 | sizeof(Thread_Control) |
---|
41 | ); |
---|
42 | } |
---|
43 | |
---|
44 | /* |
---|
45 | * _ITRON_Task_Clarify_allocation_id_error |
---|
46 | * |
---|
47 | * This function is invoked when an object allocation ID error |
---|
48 | * occurs to determine the specific ITRON error code to return. |
---|
49 | */ |
---|
50 | |
---|
51 | #define _ITRON_Task_Clarify_allocation_id_error( _id ) \ |
---|
52 | _ITRON_Objects_Clarify_allocation_id_error( \ |
---|
53 | &_ITRON_Task_Information, (_id) ) |
---|
54 | |
---|
55 | /* |
---|
56 | * _ITRON_Task_Clarify_get_id_error |
---|
57 | * |
---|
58 | * This function is invoked when an object get ID error |
---|
59 | * occurs to determine the specific ITRON error code to return. |
---|
60 | */ |
---|
61 | |
---|
62 | #define _ITRON_Task_Clarify_get_id_error( _id ) \ |
---|
63 | _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) ) |
---|
64 | |
---|
65 | /* |
---|
66 | * _ITRON_Task_Free |
---|
67 | * |
---|
68 | * DESCRIPTION: |
---|
69 | * |
---|
70 | * This routine frees a task control block to the |
---|
71 | * inactive chain of free task control blocks. |
---|
72 | * |
---|
73 | * Input parameters: |
---|
74 | * the_task - pointer to task control block |
---|
75 | * |
---|
76 | * Output parameters: NONE |
---|
77 | */ |
---|
78 | |
---|
79 | RTEMS_INLINE_ROUTINE void _ITRON_Task_Free ( |
---|
80 | Thread_Control *the_task |
---|
81 | ) |
---|
82 | { |
---|
83 | _ITRON_Objects_Free( &_ITRON_Task_Information, &the_task->Object ); |
---|
84 | } |
---|
85 | |
---|
86 | /*PAGE |
---|
87 | * |
---|
88 | * _ITRON_Task_Get |
---|
89 | * |
---|
90 | * DESCRIPTION: |
---|
91 | * |
---|
92 | * This function maps task IDs to task control blocks. |
---|
93 | * If ID corresponds to a local task, then it returns |
---|
94 | * the_task control pointer which maps to ID and location |
---|
95 | * is set to OBJECTS_LOCAL. if the task ID is global and |
---|
96 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
97 | * and the_task is undefined. Otherwise, location is set |
---|
98 | * to OBJECTS_ERROR and the_task is undefined. |
---|
99 | * |
---|
100 | * Input parameters: |
---|
101 | * id - ITRON task ID. |
---|
102 | * the_location - pointer to a location variable |
---|
103 | * |
---|
104 | * Output parameters: |
---|
105 | * *the_location - location of the object |
---|
106 | */ |
---|
107 | |
---|
108 | RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Get ( |
---|
109 | ID id, |
---|
110 | Objects_Locations *location |
---|
111 | ) |
---|
112 | { |
---|
113 | return (Thread_Control *) |
---|
114 | _ITRON_Objects_Get( &_ITRON_Task_Information, id, location ); |
---|
115 | } |
---|
116 | |
---|
117 | /*PAGE |
---|
118 | * |
---|
119 | * _ITRON_Task_Is_null |
---|
120 | * |
---|
121 | * This function returns TRUE if the_task is NULL and FALSE otherwise. |
---|
122 | * |
---|
123 | * Input parameters: |
---|
124 | * the_task - pointer to task control block |
---|
125 | * |
---|
126 | * Output parameters: |
---|
127 | * TRUE - if the_task is NULL |
---|
128 | * FALSE - otherwise |
---|
129 | */ |
---|
130 | |
---|
131 | RTEMS_INLINE_ROUTINE boolean _ITRON_Task_Is_null ( |
---|
132 | Thread_Control *the_task |
---|
133 | ) |
---|
134 | { |
---|
135 | return ( the_task == NULL ); |
---|
136 | } |
---|
137 | |
---|
138 | /* |
---|
139 | * XXX insert inline routines here |
---|
140 | */ |
---|
141 | |
---|
142 | /*PAGE |
---|
143 | * |
---|
144 | * _ITRON_tasks_Priority_to_Core |
---|
145 | */ |
---|
146 | |
---|
147 | RTEMS_INLINE_ROUTINE Priority_Control _ITRON_Task_Priority_to_Core( |
---|
148 | PRI _priority |
---|
149 | ) |
---|
150 | { |
---|
151 | return ((Priority_Control) (_priority)); |
---|
152 | } |
---|
153 | |
---|
154 | #ifdef __cplusplus |
---|
155 | } |
---|
156 | #endif |
---|
157 | |
---|
158 | #endif |
---|
159 | /* end of include file */ |
---|
160 | |
---|