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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [itron/] [src/] [ref_tsk.c] - Blame information for rev 219

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: ref_tsk.c,v 1.2 2001-09-27 11:59:13 chris Exp $
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
 
27
ER 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
 

powered by: WebSVN 2.1.0

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