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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [inline/] [rtems/] [rtems/] [region.inl] - Blame information for rev 594

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

Line No. Rev Author Line
1 30 unneback
/*  region.inl
2
 *
3
 *  This file contains the macro implementation of the inlined
4
 *  routines from the Region Manager.
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
8
 *
9
 *  The license and distribution terms for this file may be
10
 *  found in the file LICENSE in this distribution or at
11
 *  http://www.OARcorp.com/rtems/license.html.
12
 *
13
 *  $Id: region.inl,v 1.2 2001-09-27 11:59:18 chris Exp $
14
 */
15
 
16
#ifndef __REGION_inl
17
#define __REGION_inl
18
 
19
/*PAGE
20
 *
21
 *  _Region_Allocate
22
 *
23
 *  DESCRIPTION:
24
 *
25
 *  This function allocates a region control block from
26
 *  the inactive chain of free region control blocks.
27
 */
28
 
29
RTEMS_INLINE_ROUTINE Region_Control *_Region_Allocate( void )
30
{
31
  return (Region_Control *) _Objects_Allocate( &_Region_Information );
32
}
33
 
34
/*PAGE
35
 *
36
 *  _Region_Free
37
 *
38
 *  DESCRIPTION:
39
 *
40
 *  This routine frees a region control block to the
41
 *  inactive chain of free region control blocks.
42
 */
43
 
44
RTEMS_INLINE_ROUTINE void _Region_Free (
45
  Region_Control *the_region
46
)
47
{
48
  _Objects_Free( &_Region_Information, &the_region->Object );
49
}
50
 
51
/*PAGE
52
 *
53
 *  _Region_Get
54
 *
55
 *  DESCRIPTION:
56
 *
57
 *  This function maps region IDs to region control blocks.
58
 *  If ID corresponds to a local region, then it returns
59
 *  the_region control pointer which maps to ID and location
60
 *  is set to OBJECTS_LOCAL.  Otherwise, location is set
61
 *  to OBJECTS_ERROR and the_region is undefined.
62
 */
63
 
64
RTEMS_INLINE_ROUTINE Region_Control *_Region_Get (
65
  Objects_Id         id,
66
  Objects_Locations *location
67
)
68
{
69
  return (Region_Control *)
70
    _Objects_Get( &_Region_Information, id, location );
71
}
72
 
73
/*PAGE
74
 *
75
 *  _Region_Allocate_segment
76
 *
77
 *  DESCRIPTION:
78
 *
79
 *  This function attempts to allocate a segment from the_region.
80
 *  If successful, it returns the address of the allocated segment.
81
 *  Otherwise, it returns NULL.
82
 */
83
 
84
RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment (
85
  Region_Control *the_region,
86
  unsigned32      size
87
)
88
{
89
   return _Heap_Allocate( &the_region->Memory, size );
90
}
91
 
92
/*PAGE
93
 *
94
 *  _Region_Free_segment
95
 *
96
 *  DESCRIPTION:
97
 *
98
 *  This function frees the_segment to the_region.
99
 */
100
 
101
RTEMS_INLINE_ROUTINE boolean _Region_Free_segment (
102
  Region_Control *the_region,
103
  void           *the_segment
104
)
105
{
106
  return _Heap_Free( &the_region->Memory, the_segment );
107
}
108
 
109
/*PAGE
110
 *
111
 *  _Region_Is_null
112
 *
113
 *  DESCRIPTION:
114
 *
115
 *  This function returns TRUE if the_region is NULL and FALSE otherwise.
116
 */
117
 
118
RTEMS_INLINE_ROUTINE boolean _Region_Is_null (
119
  Region_Control *the_region
120
)
121
{
122
  return ( the_region == NULL  );
123
}
124
 
125
#endif
126
/* end of include file */

powered by: WebSVN 2.1.0

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