[05df0a8] | 1 | /* |
---|
| 2 | * Thread Handler |
---|
| 3 | * |
---|
| 4 | * |
---|
[08311cc3] | 5 | * COPYRIGHT (c) 1989-1999. |
---|
[05df0a8] | 6 | * On-Line Applications Research Corporation (OAR). |
---|
| 7 | * |
---|
| 8 | * The license and distribution terms for this file may be |
---|
| 9 | * found in found in the file LICENSE in this distribution or at |
---|
[dd687d97] | 10 | * http://www.rtems.com/license/LICENSE. |
---|
[05df0a8] | 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <rtems/system.h> |
---|
| 16 | #include <rtems/score/apiext.h> |
---|
| 17 | #include <rtems/score/context.h> |
---|
| 18 | #include <rtems/score/interr.h> |
---|
| 19 | #include <rtems/score/isr.h> |
---|
| 20 | #include <rtems/score/object.h> |
---|
| 21 | #include <rtems/score/priority.h> |
---|
| 22 | #include <rtems/score/states.h> |
---|
| 23 | #include <rtems/score/sysstate.h> |
---|
| 24 | #include <rtems/score/thread.h> |
---|
| 25 | #include <rtems/score/threadq.h> |
---|
| 26 | #include <rtems/score/userext.h> |
---|
| 27 | #include <rtems/score/wkspace.h> |
---|
| 28 | |
---|
| 29 | /*PAGE |
---|
| 30 | * |
---|
| 31 | * _Thread_Get |
---|
| 32 | * |
---|
| 33 | * NOTE: If we are not using static inlines, this must be a real |
---|
| 34 | * subroutine call. |
---|
| 35 | * |
---|
| 36 | * NOTE: XXX... This routine may be able to be optimized. |
---|
| 37 | */ |
---|
| 38 | |
---|
[8af72be] | 39 | #ifndef RTEMS_INLINES |
---|
[05df0a8] | 40 | |
---|
| 41 | Thread_Control *_Thread_Get ( |
---|
| 42 | Objects_Id id, |
---|
| 43 | Objects_Locations *location |
---|
| 44 | ) |
---|
| 45 | { |
---|
[ef9505a9] | 46 | unsigned32 the_api; |
---|
| 47 | unsigned32 the_class; |
---|
[05df0a8] | 48 | Objects_Information *information; |
---|
[ef9505a9] | 49 | Thread_Control *tp = (Thread_Control *) 0; |
---|
[05df0a8] | 50 | |
---|
| 51 | if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { |
---|
| 52 | _Thread_Disable_dispatch(); |
---|
| 53 | *location = OBJECTS_LOCAL; |
---|
[ef9505a9] | 54 | tp = _Thread_Executing; |
---|
| 55 | goto done; |
---|
[05df0a8] | 56 | } |
---|
| 57 | |
---|
[ef9505a9] | 58 | the_api = _Objects_Get_API( id ); |
---|
| 59 | if ( the_api && the_api > OBJECTS_APIS_LAST ) { |
---|
| 60 | *location = OBJECTS_ERROR; |
---|
| 61 | goto done; |
---|
| 62 | } |
---|
| 63 | |
---|
[05df0a8] | 64 | the_class = _Objects_Get_class( id ); |
---|
[ef9505a9] | 65 | if ( the_class != 1 ) { /* threads are always first class :) */ |
---|
[05df0a8] | 66 | *location = OBJECTS_ERROR; |
---|
[ef9505a9] | 67 | goto done; |
---|
| 68 | } |
---|
[05df0a8] | 69 | |
---|
[ef9505a9] | 70 | information = _Objects_Information_table[ the_api ][ the_class ]; |
---|
[05df0a8] | 71 | |
---|
[ef9505a9] | 72 | if ( !information ) { |
---|
[05df0a8] | 73 | *location = OBJECTS_ERROR; |
---|
[ef9505a9] | 74 | goto done; |
---|
[05df0a8] | 75 | } |
---|
| 76 | |
---|
[ef9505a9] | 77 | tp = (Thread_Control *) _Objects_Get( information, id, location ); |
---|
| 78 | |
---|
| 79 | done: |
---|
| 80 | return tp; |
---|
[05df0a8] | 81 | } |
---|
| 82 | |
---|
| 83 | #endif |
---|