OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [itron/] [inline/] [rtems/] [itron/] [task.inl] - Blame information for rev 173

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.