source: rtems/cpukit/score/src/objectget.c @ a6cbc9b

4.104.114.95
Last change on this file since a6cbc9b was a6cbc9b, checked in by Joel Sherrill <joel.sherrill@…>, on 12/17/07 at 16:01:42

2007-12-17 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/preinstall.am, posix/include/rtems/posix/timer.h, score/src/objectget.c: Split POSIX Timer implementation into multiple files. Add obvious error checks for NULL parameters. Attempt to reduce include files.
  • posix/src/timercreate.c, posix/src/timerdelete.c, posix/src/timergetoverrun.c, posix/src/timergettime.c, posix/src/timerinserthelper.c, posix/src/timersettime.c, posix/src/timertsr.c: New files.
  • posix/src/ptimer1.c: Removed.
  • Property mode set to 100644
File size: 2.2 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
34 *
35 * This routine sets the object pointer for the given
36 * object id based on the given object information structure.
37 *
38 * Input parameters:
39 *   information - pointer to entry in table for this class
40 *   id          - object id to search for
41 *   location    - address of where to store the location
42 *
43 * Output parameters:
44 *   returns  - address of object if local
45 *   location - one of the following:
46 *                  OBJECTS_ERROR  - invalid object ID
47 *                  OBJECTS_REMOTE - remote object
48 *                  OBJECTS_LOCAL  - local object
49 */
50
51Objects_Control *_Objects_Get(
52  Objects_Information *information,
53  Objects_Id           id,
54  Objects_Locations   *location
55)
56{
57  Objects_Control *the_object;
58  uint32_t         index;
59
60  index = id - information->minimum_id + 1;
61
62#if 0
63#if defined(RTEMS_MULTIPROCESSING)
64  index = id - information->minimum_id + 1;
65#else
66  /* index = _Objects_Get_index( id ); */
67  index = id & 0x0000ffff;
68  /* This should work but doesn't always :( */
69  /* index = (uint16_t) id; */
70#endif
71#endif
72
73   if ( information->maximum >= index ) {
74    _Thread_Disable_dispatch();
75    if ( (the_object = information->local_table[ index ]) != NULL ) {
76      *location = OBJECTS_LOCAL;
77      return the_object;
78    }
79    _Thread_Enable_dispatch();
80    *location = OBJECTS_ERROR;
81    return NULL;
82  }
83  *location = OBJECTS_ERROR;
84
85#if defined(RTEMS_MULTIPROCESSING)
86  _Objects_MP_Is_remote( information, id, location, &the_object );
87  return the_object;
88#else
89  return NULL;
90#endif
91}
Note: See TracBrowser for help on using the repository browser.