source: rtems/cpukit/score/src/objectgetnext.c @ 22ce0881

4.104.114.95
Last change on this file since 22ce0881 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  Object Handler
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.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/address.h>
21#include <rtems/score/chain.h>
22#include <rtems/score/object.h>
23#if defined(RTEMS_MULTIPROCESSING)
24#include <rtems/score/objectmp.h>
25#endif
26#include <rtems/score/thread.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/score/sysstate.h>
29#include <rtems/score/isr.h>
30
31/*PAGE
32 *
33 * _Objects_Get_next
34 *
35 * Like _Objects_Get, but considers the 'id' as a "hint" and
36 * finds next valid one after that point.
37 * Mostly used for monitor and debug traversal of an object.
38 *
39 * Input parameters:
40 *   information - pointer to entry in table for this class
41 *   id          - object id to search for
42 *   location    - address of where to store the location
43 *   next_id     - address to store next id to try
44 *
45 * Output parameters:
46 *   returns     - address of object if local
47 *   location    - one of the following:
48 *                  OBJECTS_ERROR  - invalid object ID
49 *                  OBJECTS_REMOTE - remote object
50 *                  OBJECTS_LOCAL  - local object
51 *   next_id     - will contain a reasonable "next" id to continue traversal
52 *
53 * NOTE:
54 *      assumes can add '1' to an id to get to next index.
55 */
56
57Objects_Control *
58_Objects_Get_next(
59    Objects_Information *information,
60    Objects_Id           id,
61    Objects_Locations   *location_p,
62    Objects_Id          *next_id_p
63)
64{
65    Objects_Control *object;
66    Objects_Id       next_id;
67
68    if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
69        next_id = information->minimum_id;
70    else
71        next_id = id;
72
73    do {
74        /* walked off end of list? */
75        if (_Objects_Get_index(next_id) > information->maximum)
76        {
77            *location_p = OBJECTS_ERROR;
78            goto final;
79        }
80
81        /* try to grab one */
82        object = _Objects_Get(information, next_id, location_p);
83
84        next_id++;
85
86    } while (*location_p != OBJECTS_LOCAL);
87
88    *next_id_p = next_id;
89    return object;
90
91final:
92    *next_id_p = OBJECTS_ID_FINAL;
93    return 0;
94}
Note: See TracBrowser for help on using the repository browser.