source: rtems/cpukit/itron/src/ref_tsk.c @ de05cbb9

4.104.114.84.95
Last change on this file since de05cbb9 was f42b726, checked in by Joel Sherrill <joel.sherrill@…>, on 01/24/01 at 14:17:28

2001-01-24 Ralf Corsepius <corsepiu@…>

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