source: rtems/c/src/exec/rtems/inline/part.inl @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*  part.inl
2 *
3 *  This file contains the macro implementation of all inlined routines
4 *  in the Partition Manager.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __PARTITION_inl
18#define __PARTITION_inl
19
20/*PAGE
21 *
22 *  _Partition_Allocate_buffer
23 *
24 */
25
26STATIC INLINE void *_Partition_Allocate_buffer (
27   Partition_Control *the_partition
28)
29{
30  return _Chain_Get( &the_partition->Memory );
31}
32
33/*PAGE
34 *
35 *  _Partition_Free_buffer
36 *
37 */
38
39STATIC INLINE void _Partition_Free_buffer (
40  Partition_Control *the_partition,
41  Chain_Node        *the_buffer
42)
43{
44  _Chain_Append( &the_partition->Memory, the_buffer );
45}
46
47/*PAGE
48 *
49 *  _Partition_Is_buffer_on_boundary
50 *
51 */
52
53STATIC INLINE boolean _Partition_Is_buffer_on_boundary (
54  void              *the_buffer,
55  Partition_Control *the_partition
56)
57{
58  unsigned32   offset;
59
60  offset = (unsigned32) _Addresses_Subtract(
61    the_buffer,
62    the_partition->starting_address
63  );
64
65  return ((offset % the_partition->buffer_size) == 0);
66}
67
68/*PAGE
69 *
70 *  _Partition_Is_buffer_valid
71 *
72 */
73
74STATIC INLINE boolean _Partition_Is_buffer_valid (
75   Chain_Node        *the_buffer,
76   Partition_Control *the_partition
77)
78{
79  void *starting;
80  void *ending;
81
82  starting = the_partition->starting_address;
83  ending   = _Addresses_Add_offset( starting, the_partition->length );
84
85  return (
86    _Addresses_Is_in_range( the_buffer, starting, ending ) &&
87    _Partition_Is_buffer_on_boundary( the_buffer, the_partition )
88  );
89}
90
91/*PAGE
92 *
93 *  _Partition_Is_buffer_size_aligned
94 *
95 */
96
97STATIC INLINE boolean _Partition_Is_buffer_size_aligned (
98   unsigned32 buffer_size
99)
100{
101  return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
102}
103
104/*PAGE
105 *
106 *  _Partition_Allocate
107 *
108 */
109
110STATIC INLINE Partition_Control *_Partition_Allocate ( void )
111{
112  return (Partition_Control *) _Objects_Allocate( &_Partition_Information );
113}
114
115/*PAGE
116 *
117 *  _Partition_Free
118 *
119 */
120
121STATIC INLINE void _Partition_Free (
122   Partition_Control *the_partition
123)
124{
125  _Objects_Free( &_Partition_Information, &the_partition->Object );
126}
127
128/*PAGE
129 *
130 *  _Partition_Get
131 *
132 */
133
134STATIC INLINE Partition_Control *_Partition_Get (
135  Objects_Id         id,
136  Objects_Locations *location
137)
138{
139  return (Partition_Control *)
140    _Objects_Get( &_Partition_Information, id, location );
141}
142
143/*PAGE
144 *
145 *  _Partition_Is_null
146 *
147 */
148
149STATIC INLINE boolean _Partition_Is_null (
150   Partition_Control *the_partition
151)
152{
153   return ( the_partition == NULL  );
154}
155
156#endif
157/* end of include file */
Note: See TracBrowser for help on using the repository browser.