RTEMS  5.0.0
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.
void _Objects_Free(Objects_Information *information, Objects_Control *the_object)
Frees an object.
Definition: objectfree.c:25
Objects_Control * _Objects_Allocate(Objects_Information *information)
Allocates an object.
Definition: objectallocate.c:89
void _Region_Process_queue(Region_Control *the_region)
Process Region Queue.
Definition: regionprocessqueue.c:25
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
Heap Handler Implementation.
Objects_Control * _Objects_Get_no_protection(Objects_Id id, const Objects_Information *information)
Maps object ids to object control blocks.
Definition: objectgetnoprotection.c:23
Definition: regiondata.h:40
RTEMS_INLINE_ROUTINE Region_Control * _Region_Allocate(void)
Region_Allocate.
Definition: regionimpl.h:47
RTEMS_INLINE_ROUTINE void * _Heap_Allocate(Heap_Control *heap, uintptr_t size)
See _Heap_Allocate_aligned_with_boundary() with alignment and boundary equals zero.
Definition: heapimpl.h:135
RTEMS_INLINE_ROUTINE bool _Region_Free_segment(Region_Control *the_region, void *the_segment)
Region_Free_segment.
Definition: regionimpl.h:110
API Mutex Handler API.
RTEMS_INLINE_ROUTINE void _Region_Free(Region_Control *the_region)
Region_Free.
Definition: regionimpl.h:58
RTEMS_INLINE_ROUTINE void * _Region_Allocate_segment(Region_Control *the_region, uintptr_t size)
Region_Allocate_segment.
Definition: regionimpl.h:97
Classic Region Manager Data Structures.
Inlined Routines in the Object Handler.
unsigned size
Definition: tte.h:74
uint32_t Objects_Id
Definition: object.h:75
bool _Heap_Free(Heap_Control *heap, void *addr)
Frees the allocated memory area starting at addr in the heap heap.
Definition: heapfree.c:99
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77