source: rtems/cpukit/score/src/objectnametoid.c @ a936aa49

4.115
Last change on this file since a936aa49 was 5a58b1e, checked in by Daniel Georgiev <daniel.georgiev95@…>, on 12/01/12 at 14:53:45

score misc: Score misc: Clean up Doxygen #11 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8013204

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Object Name To Id
5 *  @ingroup Score
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2010.
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/score/address.h>
23#include <rtems/score/chain.h>
24#include <rtems/score/object.h>
25#if defined(RTEMS_MULTIPROCESSING)
26#include <rtems/score/objectmp.h>
27#endif
28#include <rtems/score/thread.h>
29#include <rtems/score/wkspace.h>
30#include <rtems/score/sysstate.h>
31#include <rtems/score/isr.h>
32
33Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
34  Objects_Information *information,
35  uint32_t             name,
36  uint32_t             node,
37  Objects_Id          *id
38)
39{
40  bool                       search_local_node;
41  Objects_Control           *the_object;
42  uint32_t                   index;
43#if defined(RTEMS_MULTIPROCESSING)
44  Objects_Name               name_for_mp;
45#endif
46
47  /* ASSERT: information->is_string == false */
48
49  if ( !id )
50    return OBJECTS_INVALID_ADDRESS;
51
52  if ( name == 0 )
53    return OBJECTS_INVALID_NAME;
54
55  search_local_node = false;
56
57  if ( information->maximum != 0 &&
58      (node == OBJECTS_SEARCH_ALL_NODES ||
59       node == OBJECTS_SEARCH_LOCAL_NODE ||
60       _Objects_Is_local_node( node )
61      ))
62   search_local_node = true;
63
64  if ( search_local_node ) {
65    for ( index = 1; index <= information->maximum; index++ ) {
66      the_object = information->local_table[ index ];
67      if ( !the_object )
68        continue;
69
70      if ( name == the_object->name.name_u32 ) {
71        *id = the_object->id;
72        return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
73      }
74    }
75  }
76
77#if defined(RTEMS_MULTIPROCESSING)
78  if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE )
79    return OBJECTS_INVALID_NAME;
80
81  name_for_mp.name_u32 = name;
82  return _Objects_MP_Global_name_search( information, name_for_mp, node, id );
83#else
84  return OBJECTS_INVALID_NAME;
85#endif
86}
Note: See TracBrowser for help on using the repository browser.