source: rtems/c/src/exec/itron/src/ref_tsk.c @ 9d9a3dd

4.104.114.84.95
Last change on this file since 9d9a3dd was 9d9a3dd, checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/17/99 at 16:47:58

+ Updated copyright information.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
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$
10 */
11
12#include <itron.h>
13
14#include <rtems/score/thread.h>
15#include <rtems/score/userext.h>
16#include <rtems/score/wkspace.h>
17#include <rtems/score/apiext.h>
18#include <rtems/score/sysstate.h>
19
20#include <rtems/itron/task.h>
21
22
23/*
24 *  ref_tsk - Reference Task Status
25 */
26
27ER ref_tsk(
28  T_RTSK *pk_rtsk,
29  ID      tskid
30)
31{
32  register Thread_Control *the_thread;
33  Objects_Locations        location;
34  Priority_Control         core_priority; 
35
36  if (!pk_rtsk)
37    return E_PAR;
38
39  the_thread = _ITRON_Task_Get( tskid, &location );
40  switch ( location ) {
41    case OBJECTS_REMOTE:
42    case OBJECTS_ERROR:
43      return _ITRON_Task_Clarify_get_id_error( tskid );
44 
45    case OBJECTS_LOCAL:
46
47      if ( location != OBJECTS_LOCAL )
48        return  _ITRON_Task_Clarify_get_id_error( tskid );
49
50      /*
51       * The following are extended functions [level X ].
52       * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
53       */
54
55      pk_rtsk->tskwait = 0;
56      pk_rtsk->wid     = 0;
57      pk_rtsk->wupcnt  = 0;
58      pk_rtsk->suscnt  = the_thread->suspend_count;
59      pk_rtsk->tskatr  = 0;       /* XXX - Not correctly implemented */
60      pk_rtsk->task    = (FP) the_thread->Start.entry_point;
61      core_priority    = the_thread->Start.initial_priority;
62      pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
63      pk_rtsk->stksz   = the_thread->Start.Initial_stack.size;
64
65      /*
66       * The following are required.
67       */
68
69      pk_rtsk->exinf   = NULL;   /* extended information */
70      pk_rtsk->tskpri  =
71                    _ITRON_Task_Core_to_Priority(the_thread->current_priority);
72
73      /*
74       * Mask in the tskstat information
75       * Convert the task state XXX double check this
76       */
77
78      pk_rtsk->tskstat = 0;
79      if ( the_thread == _Thread_Executing )
80        pk_rtsk->tskstat |= TTS_RUN;
81      if ( _States_Is_ready(the_thread->current_state) )
82        pk_rtsk->tskstat |= TTS_RDY; 
83      if ( _States_Is_dormant( the_thread->current_state) )
84        pk_rtsk->tskstat |= TTS_DMT;
85      if ( _States_Is_suspended(the_thread->current_state) )
86        pk_rtsk->tskstat |= TTS_SUS;
87      if ( _States_Is_blocked(the_thread->current_state) )
88        pk_rtsk->tskstat |= TTS_WAI;
89
90      break;
91  }
92
93  _ITRON_return_errorno( E_OK );
94
95}
96
97
98
99
Note: See TracBrowser for help on using the repository browser.