OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [taskvariableget.c] - Blame information for rev 30

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  rtems_task_variable_get - Get a per-task variable
3
 *
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: taskvariableget.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/rtems/tasks.h>
17
#include <rtems/score/wkspace.h>
18
 
19
/*
20
 *  rtems_task_variable_get
21
 *
22
 *  This directive gets the value of a task variable.
23
 */
24
 
25
rtems_status_code rtems_task_variable_get(
26
  rtems_id tid,
27
  void **ptr,
28
  void **result
29
)
30
{
31
  Thread_Control        *the_thread;
32
  Objects_Locations      location;
33
  rtems_task_variable_t *tvp;
34
 
35
  the_thread = _Thread_Get (tid, &location);
36
  switch (location) {
37
  case OBJECTS_REMOTE:
38
#if defined(RTEMS_MULTIPROCESSING)
39
    _Thread_Dispatch();
40
    return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
41
#endif
42
 
43
  case OBJECTS_ERROR:
44
    return RTEMS_INVALID_ID;
45
 
46
  default:
47
    return RTEMS_INTERNAL_ERROR;
48
 
49
  case OBJECTS_LOCAL:
50
 
51
    /*
52
     *  Figure out if the variable is in this task's list.
53
     */
54
 
55
    tvp = the_thread->task_variables;
56
    while (tvp) {
57
      if (tvp->ptr == ptr) {
58
        /*
59
         * Should this return the current (i.e not the
60
         * saved) value if `tid' is the current task?
61
         */
62
        *result = tvp->tval;
63
        _Thread_Enable_dispatch();
64
        return RTEMS_SUCCESSFUL;
65
      }
66
      tvp = tvp->next;
67
    }
68
    _Thread_Enable_dispatch();
69
    return RTEMS_INVALID_ADDRESS;
70
  }
71
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
72
}

powered by: WebSVN 2.1.0

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