OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [src/] [objectgetnext.c] - Blame information for rev 581

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.