1 | /** |
---|
2 | * @file rtems/rtems/part.inl |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * This file contains the macro implementation of all inlined routines |
---|
7 | * in the Partition Manager. |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_RTEMS_PART_INL |
---|
20 | #define _RTEMS_RTEMS_PART_INL |
---|
21 | |
---|
22 | /*PAGE |
---|
23 | * |
---|
24 | * _Partition_Allocate_buffer |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | #define _Partition_Allocate_buffer( _the_partition ) \ |
---|
29 | _Chain_Get( &(_the_partition)->Memory ) |
---|
30 | |
---|
31 | /*PAGE |
---|
32 | * |
---|
33 | * _Partition_Free_buffer |
---|
34 | * |
---|
35 | */ |
---|
36 | |
---|
37 | #define _Partition_Free_buffer( _the_partition, _the_buffer ) \ |
---|
38 | _Chain_Append( &(_the_partition)->Memory, (_the_buffer) ) |
---|
39 | |
---|
40 | /*PAGE |
---|
41 | * |
---|
42 | * _Partition_Is_buffer_on_boundary |
---|
43 | * |
---|
44 | */ |
---|
45 | |
---|
46 | #define _Partition_Is_buffer_on_boundary( _the_buffer, _the_partition ) \ |
---|
47 | ((((uint32_t ) _Addresses_Subtract( \ |
---|
48 | (_the_buffer), \ |
---|
49 | (_the_partition)->starting_address ) \ |
---|
50 | ) % \ |
---|
51 | (_the_partition)->buffer_size) == 0) |
---|
52 | |
---|
53 | /*PAGE |
---|
54 | * |
---|
55 | * _Partition_Is_buffer_valid |
---|
56 | * |
---|
57 | */ |
---|
58 | |
---|
59 | #define _Partition_Is_buffer_valid( _the_buffer, _the_partition ) \ |
---|
60 | ( \ |
---|
61 | _Addresses_Is_in_range( \ |
---|
62 | (_the_buffer), \ |
---|
63 | (_the_partition)->starting_address, \ |
---|
64 | _Addresses_Add_offset( \ |
---|
65 | (_the_partition)->starting_address, \ |
---|
66 | (_the_partition)->length \ |
---|
67 | ) \ |
---|
68 | ) && \ |
---|
69 | _Partition_Is_buffer_on_boundary( (_the_buffer), (_the_partition) ) \ |
---|
70 | ) |
---|
71 | |
---|
72 | /*PAGE |
---|
73 | * |
---|
74 | * _Partition_Is_buffer_size_aligned |
---|
75 | * |
---|
76 | */ |
---|
77 | |
---|
78 | #define _Partition_Is_buffer_size_aligned( _buffer_size ) \ |
---|
79 | ((_buffer_size) % CPU_PARTITION_ALIGNMENT == 0) |
---|
80 | |
---|
81 | /*PAGE |
---|
82 | * |
---|
83 | * _Partition_Allocate |
---|
84 | * |
---|
85 | */ |
---|
86 | |
---|
87 | #define _Partition_Allocate() \ |
---|
88 | (Partition_Control *) _Objects_Allocate( &_Partition_Information ) |
---|
89 | |
---|
90 | /*PAGE |
---|
91 | * |
---|
92 | * _Partition_Free |
---|
93 | * |
---|
94 | */ |
---|
95 | |
---|
96 | #define _Partition_Free( _the_partition ) \ |
---|
97 | _Objects_Free( &_Partition_Information, &(_the_partition)->Object ) |
---|
98 | |
---|
99 | /*PAGE |
---|
100 | * |
---|
101 | * _Partition_Get |
---|
102 | * |
---|
103 | */ |
---|
104 | |
---|
105 | #define _Partition_Get( _id, _location ) \ |
---|
106 | (Partition_Control *) \ |
---|
107 | _Objects_Get( &_Partition_Information, (_id), (_location) ) |
---|
108 | |
---|
109 | /*PAGE |
---|
110 | * |
---|
111 | * _Partition_Is_null |
---|
112 | * |
---|
113 | */ |
---|
114 | |
---|
115 | #define _Partition_Is_null( _the_partition ) \ |
---|
116 | ( (_the_partition) == NULL ) |
---|
117 | |
---|
118 | #endif |
---|
119 | /* end of include file */ |
---|