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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  RTEMS Task Manager
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: tasksetnote.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/rtems/status.h>
17
#include <rtems/rtems/support.h>
18
#include <rtems/rtems/modes.h>
19
#include <rtems/score/object.h>
20
#include <rtems/score/stack.h>
21
#include <rtems/score/states.h>
22
#include <rtems/rtems/tasks.h>
23
#include <rtems/score/thread.h>
24
#include <rtems/score/threadq.h>
25
#include <rtems/score/tod.h>
26
#include <rtems/score/userext.h>
27
#include <rtems/score/wkspace.h>
28
#include <rtems/score/apiext.h>
29
#include <rtems/score/sysstate.h>
30
 
31
/*PAGE
32
 *
33
 * rtems_task_set_note
34
 *
35
 *  This directive sets the specified notepad contents to the given
36
 *  note.
37
 *
38
 *  Input parameters:
39
 *    id      - thread id
40
 *    notepad - notepad number
41
 *    note    - note value
42
 *
43
 *  Output parameters:
44
 *    RTEMS_SUCCESSFUL - if successful
45
 *    error code        - if unsuccessful
46
 */
47
 
48
rtems_status_code rtems_task_set_note(
49
  Objects_Id id,
50
  unsigned32 notepad,
51
  unsigned32 note
52
)
53
{
54
  register Thread_Control *the_thread;
55
  Objects_Locations        location;
56
  RTEMS_API_Control       *api;
57
 
58
  /*
59
   *  NOTE:  There is no check for < RTEMS_NOTEPAD_FIRST because that would
60
   *         be checking an unsigned number for being negative.
61
   */
62
 
63
  if ( notepad > RTEMS_NOTEPAD_LAST )
64
    return RTEMS_INVALID_NUMBER;
65
 
66
  /*
67
   *  Optimize the most likely case to avoid the Thread_Dispatch.
68
   */
69
 
70
  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
71
       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
72
      api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
73
      api->Notepads[ notepad ] = note;
74
      return RTEMS_SUCCESSFUL;
75
  }
76
 
77
  the_thread = _Thread_Get( id, &location );
78
  switch ( location ) {
79
 
80
    case OBJECTS_REMOTE:
81
#if defined(RTEMS_MULTIPROCESSING)
82
      return _RTEMS_tasks_MP_Send_request_packet(
83
        RTEMS_TASKS_MP_SET_NOTE_REQUEST,
84
        id,
85
        0,          /* Not used */
86
        notepad,
87
        note
88
      );
89
#endif
90
 
91
    case OBJECTS_ERROR:
92
      return RTEMS_INVALID_ID;
93
 
94
    case OBJECTS_LOCAL:
95
      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
96
      api->Notepads[ notepad ] = note;
97
      _Thread_Enable_dispatch();
98
      return RTEMS_SUCCESSFUL;
99
  }
100
 
101
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
102
}

powered by: WebSVN 2.1.0

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