RTEMS
regionimpl.h
Go to the documentation of this file.
1 
9 /* COPYRIGHT (c) 1989-2008.
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.org/license/LICENSE.
15  */
16 
17 #ifndef _RTEMS_RTEMS_REGIONIMPL_H
18 #define _RTEMS_RTEMS_REGIONIMPL_H
19 
20 #include <rtems/rtems/regiondata.h>
21 #include <rtems/score/apimutex.h>
22 #include <rtems/score/heapimpl.h>
23 #include <rtems/score/objectimpl.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
38 #define REGION_OF_THREAD_QUEUE_QUEUE( queue ) \
39  RTEMS_CONTAINER_OF( queue, Region_Control, Wait_queue.Queue )
40 
48 {
50 }
51 
59  Region_Control *the_region
60 )
61 {
62  _Thread_queue_Destroy( &the_region->Wait_queue );
63  _Objects_Free( &_Region_Information, &the_region->Object );
64 }
65 
66 RTEMS_INLINE_ROUTINE Region_Control *_Region_Get_and_lock( Objects_Id id )
67 {
68  Region_Control *the_region;
69 
70  _RTEMS_Lock_allocator();
71 
72  the_region = (Region_Control *)
74 
75  if ( the_region != NULL ) {
76  /* Keep allocator lock */
77  return the_region;
78  }
79 
80  _RTEMS_Unlock_allocator();
81  return NULL;
82 }
83 
84 RTEMS_INLINE_ROUTINE void _Region_Unlock( Region_Control *the_region )
85 {
86  (void) the_region;
87  _RTEMS_Unlock_allocator();
88 }
89 
98  Region_Control *the_region,
99  uintptr_t size
100 )
101 {
102  return _Heap_Allocate( &the_region->Memory, size );
103 }
104 
111  Region_Control *the_region,
112  void *the_segment
113 )
114 {
115  return _Heap_Free( &the_region->Memory, the_segment );
116 }
117 
127 extern void _Region_Process_queue(Region_Control *the_region);
128 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif
136 /* end of include file */
Objects_Information _Region_Information
The Classic Region objects information.
static __inline__ void _Region_Free(Region_Control *the_region)
Region_Free.
Definition: regionimpl.h:58
bool _Heap_Free(Heap_Control *heap, void *addr)
Frees the allocated memory area.
void _Region_Process_queue(Region_Control *the_region)
Process Region Queue.
RTEMS_INLINE_ROUTINE void * _Heap_Allocate(Heap_Control *heap, uintptr_t size)
Allocates a memory area.
Definition: heapimpl.h:160
Heap Handler Implementation.
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
static __inline__ Region_Control * _Region_Allocate(void)
Region_Allocate.
Definition: regionimpl.h:47
static __inline__ void * _Region_Allocate_segment(Region_Control *the_region, uintptr_t size)
Region_Allocate_segment.
Definition: regionimpl.h:97
Inlined Routines in the Object Handler.
API Mutex Handler API.
Constants and Structures Associated with the Manipulation of Objects.
uint32_t Objects_Id
Definition: object.h:80
Classic Region Manager Data Structures.
static __inline__ void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
Definition: threadqimpl.h:1378
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
static __inline__ bool _Region_Free_segment(Region_Control *the_region, void *the_segment)
Region_Free_segment.
Definition: regionimpl.h:110
Objects_Control * _Objects_Get_no_protection(Objects_Id id, const Objects_Information *information)
Maps object ids to object control blocks.
static __inline__ void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectimpl.h:933