source: rtems/cpukit/score/src/objectgetnext.c @ e6f7f81

4.115
Last change on this file since e6f7f81 was 8396c18e, checked in by Mathew Kallada <matkallada@…>, on 11/30/12 at 02:01:26

Score misc: Clean up Doxygen #8 (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/7970221

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Get Pointer to Next Object that is Active
5 * @ingroup ScoreObject
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
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
33/*
34 * _Objects_Get_next
35 *
36 * Like _Objects_Get, but considers the 'id' as a "hint" and
37 * finds next valid one after that point.
38 * Mostly used for monitor and debug traversal of an object.
39 *
40 * Input parameters:
41 *   information - pointer to entry in table for this class
42 *   id          - object id to search for
43 *   location    - address of where to store the location
44 *   next_id     - address to store next id to try
45 *
46 * Output parameters:
47 *   returns     - address of object if local
48 *   location    - one of the following:
49 *                  OBJECTS_ERROR  - invalid object ID
50 *                  OBJECTS_REMOTE - remote object
51 *                  OBJECTS_LOCAL  - local object
52 *   next_id     - will contain a reasonable "next" id to continue traversal
53 *
54 * NOTE:
55 *      assumes can add '1' to an id to get to next index.
56 */
57
58Objects_Control *
59_Objects_Get_next(
60    Objects_Information *information,
61    Objects_Id           id,
62    Objects_Locations   *location_p,
63    Objects_Id          *next_id_p
64)
65{
66    Objects_Control *object;
67    Objects_Id       next_id;
68
69    if ( !information )
70      return NULL;
71
72    if ( !location_p )
73      return NULL;
74
75    if ( !next_id_p )
76      return NULL;
77
78    if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
79        next_id = information->minimum_id;
80    else
81        next_id = id;
82
83    do {
84        /* walked off end of list? */
85        if (_Objects_Get_index(next_id) > information->maximum)
86        {
87            *location_p = OBJECTS_ERROR;
88            goto final;
89        }
90
91        /* try to grab one */
92        object = _Objects_Get(information, next_id, location_p);
93
94        next_id++;
95
96    } while (*location_p != OBJECTS_LOCAL);
97
98    *next_id_p = next_id;
99    return object;
100
101final:
102    *next_id_p = OBJECTS_ID_FINAL;
103    return 0;
104}
Note: See TracBrowser for help on using the repository browser.