source: rtems/cpukit/rtems/src/taskgetnote.c @ 205dbb9d

4.115
Last change on this file since 205dbb9d was 205dbb9d, checked in by Alex Ivanov <alexivanov97@…>, on 12/03/12 at 19:18:33

cpukit: Clean up Doxygen #3 (GCI 2012)

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Get Task Node
5 *  @ingroup ClassicRTEMS
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/config.h>
23#include <rtems/rtems/status.h>
24#include <rtems/rtems/support.h>
25#include <rtems/rtems/modes.h>
26#include <rtems/score/object.h>
27#include <rtems/score/stack.h>
28#include <rtems/score/states.h>
29#include <rtems/rtems/tasks.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/threadq.h>
32#include <rtems/score/tod.h>
33#include <rtems/score/wkspace.h>
34#include <rtems/score/apiext.h>
35#include <rtems/score/sysstate.h>
36
37rtems_status_code rtems_task_get_note(
38  rtems_id    id,
39  uint32_t    notepad,
40  uint32_t   *note
41)
42{
43  register Thread_Control *the_thread;
44  Objects_Locations        location;
45  RTEMS_API_Control       *api;
46
47  if ( !rtems_configuration_get_notepads_enabled() )
48    return RTEMS_NOT_CONFIGURED;
49
50  if ( !note )
51    return RTEMS_INVALID_ADDRESS;
52
53  /*
54   *  NOTE:  There is no check for < RTEMS_NOTEPAD_FIRST because that would
55   *         be checking an unsigned number for being negative.
56   */
57
58  if ( notepad > RTEMS_NOTEPAD_LAST )
59    return RTEMS_INVALID_NUMBER;
60
61  /*
62   *  Optimize the most likely case to avoid the Thread_Dispatch.
63   */
64
65  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
66       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
67      api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
68      *note = api->Notepads[ notepad ];
69      return RTEMS_SUCCESSFUL;
70  }
71
72  the_thread = _Thread_Get( id, &location );
73  switch ( location ) {
74
75    case OBJECTS_LOCAL:
76      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
77      *note = api->Notepads[ notepad ];
78      _Thread_Enable_dispatch();
79      return RTEMS_SUCCESSFUL;
80
81#if defined(RTEMS_MULTIPROCESSING)
82    case OBJECTS_REMOTE:
83      _Thread_Executing->Wait.return_argument = note;
84
85      return _RTEMS_tasks_MP_Send_request_packet(
86        RTEMS_TASKS_MP_GET_NOTE_REQUEST,
87        id,
88        0,          /* Not used */
89        notepad,
90        0           /* Not used */
91      );
92#endif
93
94    case OBJECTS_ERROR:
95      break;
96  }
97
98  return RTEMS_INVALID_ID;
99}
Note: See TracBrowser for help on using the repository browser.