OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [itron/] [src/] [ref_tsk.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  ref_tsk.c,v 1.6 2001/01/24 14:15:04 joel Exp
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
 
31
ER 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
 

powered by: WebSVN 2.1.0

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