source: rtems/cpukit/itron/src/ref_tsk.c @ 78b867e2

4.10
Last change on this file since 78b867e2 was 78b867e2, checked in by Gedare Bloom <gedare@…>, on 12/21/17 at 16:49:30

score: replace current and real priority with priority node

Encapsulate the current_priority and real_priority fields of
the thread control block with a Thread_Priority_node struct.
Propagate modifications throughout the tree where the two
fields are directly accessed.

Updates #3359.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
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.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/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#if defined(RTEMS_MULTIPROCESSING)
46    case OBJECTS_REMOTE:
47#endif
48    case OBJECTS_ERROR:
49      return _ITRON_Task_Clarify_get_id_error( tskid );
50
51    case OBJECTS_LOCAL:
52
53      if ( location != OBJECTS_LOCAL )
54        return  _ITRON_Task_Clarify_get_id_error( tskid );
55
56      /*
57       * The following are extended functions [level X ].
58       * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
59       */
60
61      pk_rtsk->tskwait = 0;
62      pk_rtsk->wid     = 0;
63      pk_rtsk->wupcnt  = 0;
64      pk_rtsk->suscnt  = the_thread->suspend_count;
65      pk_rtsk->tskatr  = 0;       /* XXX - Not correctly implemented */
66      pk_rtsk->task    = (FP) the_thread->Start.entry_point;
67      core_priority    = the_thread->Start.initial_priority;
68      pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
69      pk_rtsk->stksz   = the_thread->Start.Initial_stack.size;
70
71      /*
72       * The following are required.
73       */
74
75      pk_rtsk->exinf   = NULL;   /* extended information */
76      pk_rtsk->tskpri  =
77                    _ITRON_Task_Core_to_Priority(the_thread->Priority_node.current_priority);
78
79      /*
80       * Mask in the tskstat information
81       * Convert the task state XXX double check this
82       */
83
84      pk_rtsk->tskstat = 0;
85      if ( the_thread == _Thread_Executing )
86        pk_rtsk->tskstat |= TTS_RUN;
87      if ( _States_Is_ready(the_thread->current_state) )
88        pk_rtsk->tskstat |= TTS_RDY;
89      if ( _States_Is_dormant( the_thread->current_state) )
90        pk_rtsk->tskstat |= TTS_DMT;
91      if ( _States_Is_suspended(the_thread->current_state) )
92        pk_rtsk->tskstat |= TTS_SUS;
93      if ( _States_Is_blocked(the_thread->current_state) )
94        pk_rtsk->tskstat |= TTS_WAI;
95
96      break;
97  }
98
99  _ITRON_return_errorno( E_OK );
100
101}
Note: See TracBrowser for help on using the repository browser.