1 | /* tasks.inl |
---|
2 | * |
---|
3 | * This file contains the static inline implementation of all inlined |
---|
4 | * routines in the with RTEMS Tasks Manager. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __RTEMS_TASKS_inl |
---|
18 | #define __RTEMS_TASKS_inl |
---|
19 | |
---|
20 | #include <rtems/msgmp.h> |
---|
21 | #include <rtems/partmp.h> |
---|
22 | #include <rtems/regionmp.h> |
---|
23 | #include <rtems/semmp.h> |
---|
24 | |
---|
25 | /*PAGE |
---|
26 | * |
---|
27 | * _RTEMS_tasks_Allocate |
---|
28 | * |
---|
29 | */ |
---|
30 | |
---|
31 | STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void ) |
---|
32 | { |
---|
33 | return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ); |
---|
34 | } |
---|
35 | |
---|
36 | /*PAGE |
---|
37 | * |
---|
38 | * _RTEMS_tasks_Free |
---|
39 | * |
---|
40 | */ |
---|
41 | |
---|
42 | STATIC INLINE void _RTEMS_tasks_Free ( |
---|
43 | Thread_Control *the_task |
---|
44 | ) |
---|
45 | { |
---|
46 | _Objects_Free( |
---|
47 | _Objects_Get_information( the_task->Object.id ), |
---|
48 | &the_task->Object |
---|
49 | ); |
---|
50 | } |
---|
51 | |
---|
52 | /*PAGE |
---|
53 | * |
---|
54 | * _RTEMS_tasks_Cancel_wait |
---|
55 | * |
---|
56 | */ |
---|
57 | |
---|
58 | STATIC INLINE void _RTEMS_tasks_Cancel_wait( |
---|
59 | Thread_Control *the_thread |
---|
60 | ) |
---|
61 | { |
---|
62 | States_Control state; |
---|
63 | States_Control remote_state; |
---|
64 | |
---|
65 | state = the_thread->current_state; |
---|
66 | |
---|
67 | /* XXX do this with the object class */ |
---|
68 | if ( _States_Is_waiting_on_thread_queue( state ) ) { |
---|
69 | if ( _States_Is_waiting_for_rpc_reply( state ) && |
---|
70 | _States_Is_locally_blocked( state ) ) { |
---|
71 | remote_state = _States_Clear( |
---|
72 | STATES_WAITING_FOR_RPC_REPLY | STATES_TRANSIENT, |
---|
73 | state |
---|
74 | ); |
---|
75 | |
---|
76 | switch ( remote_state ) { |
---|
77 | |
---|
78 | case STATES_WAITING_FOR_BUFFER: |
---|
79 | _Partition_MP_Send_extract_proxy( the_thread ); |
---|
80 | break; |
---|
81 | case STATES_WAITING_FOR_SEGMENT: |
---|
82 | _Region_MP_Send_extract_proxy( the_thread ); |
---|
83 | break; |
---|
84 | case STATES_WAITING_FOR_SEMAPHORE: |
---|
85 | _Semaphore_MP_Send_extract_proxy( the_thread ); |
---|
86 | break; |
---|
87 | case STATES_WAITING_FOR_MESSAGE: |
---|
88 | _Message_queue_MP_Send_extract_proxy( the_thread ); |
---|
89 | break; |
---|
90 | } |
---|
91 | } |
---|
92 | _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); |
---|
93 | } |
---|
94 | else if ( _Watchdog_Is_active( &the_thread->Timer ) ) |
---|
95 | (void) _Watchdog_Remove( &the_thread->Timer ); |
---|
96 | } |
---|
97 | |
---|
98 | /*PAGE |
---|
99 | * |
---|
100 | * _RTEMS_Tasks_Priority_to_Core |
---|
101 | */ |
---|
102 | |
---|
103 | STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( |
---|
104 | rtems_task_priority priority |
---|
105 | ) |
---|
106 | { |
---|
107 | return (Priority_Control) priority; |
---|
108 | } |
---|
109 | |
---|
110 | #endif |
---|
111 | /* end of include file */ |
---|