From b06e68ef1f6df69cc86d72356c3a002054a35fad Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 17 Aug 1995 19:51:51 +0000 Subject: Numerous miscellaneous features incorporated from Tony Bennett (tbennett@divnc.com) including the following major additions: + variable length messages + named devices + debug monitor + association tables/variables --- cpukit/score/src/object.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/object.c b/cpukit/score/src/object.c index 71c365fa1e..29450d4171 100644 --- a/cpukit/score/src/object.c +++ b/cpukit/score/src/object.c @@ -12,6 +12,7 @@ * * $Id$ */ + #include #include #include @@ -226,3 +227,69 @@ Objects_Control *_Objects_Get( _Objects_MP_Is_remote( information, id, location, &the_object ); return the_object; } + + +/*PAGE + * + * _Objects_Get_next + * + * Like _Objects_Get, but considers the 'id' as a "hint" and + * finds next valid one after that point. + * Mostly used for monitor and debug traversal of an object. + * + * Input parameters: + * information - pointer to entry in table for this class + * id - object id to search for + * location - address of where to store the location + * next_id - address to store next id to try + * + * Output parameters: + * returns - address of object if local + * location - one of the following: + * OBJECTS_ERROR - invalid object ID + * OBJECTS_REMOTE - remote object + * OBJECTS_LOCAL - local object + * next_id - will contain a reasonable "next" id to continue traversal + * + * NOTE: + * assumes can add '1' to an id to get to next index. + */ + +Objects_Control * +_Objects_Get_next( + Objects_Information *information, + Objects_Id id, + unsigned32 *location_p, + Objects_Id *next_id_p +) +{ + Objects_Control *object; + Objects_Id next_id; + + if (rtems_get_index(id) == RTEMS_OBJECT_ID_INITIAL_INDEX) + next_id = information->minimum_id; + else + next_id = id; + + do { + /* walked off end of list? */ + if (next_id > information->maximum_id) + { + *location_p = OBJECTS_ERROR; + goto final; + } + + /* try to grab one */ + object = _Objects_Get(information, next_id, location_p); + + next_id++; + + } while (*location_p != OBJECTS_LOCAL); + + *next_id_p = next_id; + return object; + +final: + *next_id_p = RTEMS_OBJECT_ID_FINAL; + return 0; +} -- cgit v1.2.3