source: rtems/cpukit/score/src/objectgetisr.c @ d7c3883

4.115
Last change on this file since d7c3883 was b028e725, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/09 at 20:09:02

2009-01-05 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/object.h, score/src/objectallocatebyindex.c: Object index should be int. Fix bug when index is negative.
  • score/src/objectextendinformation.c: Do not allow maximum number of allocated objects to exceed maximum representable in index field of Object Id.
  • score/src/objectgetisr.c: Use same code that is in _Objects_Get to extract index field of Object Id.
  • Property mode set to 100644
File size: 2.1 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_isr_disable
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 *   level       - pointer to previous interrupt level
43 *
44 * Output parameters:
45 *   returns  - address of object if local
46 *   location - one of the following:
47 *                  OBJECTS_ERROR  - invalid object ID
48 *                  OBJECTS_REMOTE - remote object
49 *                  OBJECTS_LOCAL  - local object
50 *  *level    - previous interrupt level
51 */
52
53Objects_Control *_Objects_Get_isr_disable(
54  Objects_Information *information,
55  Objects_Id           id,
56  Objects_Locations   *location,
57  ISR_Level           *level_p
58)
59{
60  Objects_Control *the_object;
61  uint32_t         index;
62  ISR_Level        level;
63
64  index = id - information->minimum_id + 1;
65
66  _ISR_Disable( level );
67  if ( information->maximum >= index ) {
68    if ( (the_object = information->local_table[ index ]) != NULL ) {
69      *location = OBJECTS_LOCAL;
70      *level_p = level;
71      return the_object;
72    }
73    _ISR_Enable( level );
74    *location = OBJECTS_ERROR;
75    return NULL;
76  }
77  _ISR_Enable( level );
78  *location = OBJECTS_ERROR;
79
80#if defined(RTEMS_MULTIPROCESSING)
81  _Objects_MP_Is_remote( information, id, location, &the_object );
82  return the_object;
83#else
84  return NULL;
85#endif
86}
Note: See TracBrowser for help on using the repository browser.