source: rtems/cpukit/rtems/src/taskgetnote.c @ e6b31b27

4.115
Last change on this file since e6b31b27 was 217b3f53, checked in by Joel Sherrill <joel.sherrill@…>, on 03/14/15 at 16:04:25

Disable deprecated warning on implementation of deprecated methods

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Get Task Node
5 *  @ingroup ClassicRTEMS
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/tasksimpl.h>
22#include <rtems/score/threadimpl.h>
23#include <rtems/config.h>
24
25/*
26 * We know this is deprecated and don't want a warning on every BSP built.
27 */
28#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
29
30rtems_status_code rtems_task_get_note(
31  rtems_id    id,
32  uint32_t    notepad,
33  uint32_t   *note
34)
35{
36  Thread_Control          *the_thread;
37  Objects_Locations        location;
38  RTEMS_API_Control       *api;
39  Thread_Control          *executing;
40
41  if ( !rtems_configuration_get_notepads_enabled() )
42    return RTEMS_NOT_CONFIGURED;
43
44  if ( !note )
45    return RTEMS_INVALID_ADDRESS;
46
47  /*
48   *  NOTE:  There is no check for < RTEMS_NOTEPAD_FIRST because that would
49   *         be checking an unsigned number for being negative.
50   */
51
52  if ( notepad > RTEMS_NOTEPAD_LAST )
53    return RTEMS_INVALID_NUMBER;
54
55  /*
56   *  Optimize the most likely case to avoid the Thread_Dispatch.
57   */
58
59  executing = _Thread_Get_executing();
60  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
61       _Objects_Are_ids_equal( id, executing->Object.id ) ) {
62      api = executing->API_Extensions[ THREAD_API_RTEMS ];
63      *note = api->Notepads[ notepad ];
64      return RTEMS_SUCCESSFUL;
65  }
66
67  the_thread = _Thread_Get( id, &location );
68  switch ( location ) {
69
70    case OBJECTS_LOCAL:
71      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
72      *note = api->Notepads[ notepad ];
73      _Objects_Put( &the_thread->Object );
74      return RTEMS_SUCCESSFUL;
75
76#if defined(RTEMS_MULTIPROCESSING)
77    case OBJECTS_REMOTE:
78      executing->Wait.return_argument = note;
79
80      return _RTEMS_tasks_MP_Send_request_packet(
81        RTEMS_TASKS_MP_GET_NOTE_REQUEST,
82        id,
83        0,          /* Not used */
84        notepad,
85        0           /* Not used */
86      );
87#endif
88
89    case OBJECTS_ERROR:
90      break;
91  }
92
93  return RTEMS_INVALID_ID;
94}
Note: See TracBrowser for help on using the repository browser.