source: rtems/cpukit/include/rtems/rtems/regionimpl.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicRegionImpl
5 *
6 * @brief Classic Region Manager Implementation
7 */
8
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/region.h>
21#include <rtems/score/apimutex.h>
22#include <rtems/score/heapimpl.h>
23#include <rtems/score/objectimpl.h>
24#include <rtems/score/threadqimpl.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @defgroup ClassicRegionImpl Classic Region Manager Implementation
32 *
33 * @ingroup ClassicRegion
34 *
35 * @{
36 */
37
38#define REGION_OF_THREAD_QUEUE_QUEUE( queue ) \
39  RTEMS_CONTAINER_OF( queue, Region_Control, Wait_queue.Queue )
40
41/**
42 *  The following defines the information control block used to
43 *  manage this class of objects.
44 */
45extern Objects_Information _Region_Information;
46
47/**
48 *  @brief Region_Allocate
49 *
50 *  This function allocates a region control block from
51 *  the inactive chain of free region control blocks.
52 */
53RTEMS_INLINE_ROUTINE Region_Control *_Region_Allocate( void )
54{
55  return (Region_Control *) _Objects_Allocate( &_Region_Information );
56}
57
58/**
59 *  @brief Region_Free
60 *
61 *  This routine frees a region control block to the
62 *  inactive chain of free region control blocks.
63 */
64RTEMS_INLINE_ROUTINE void _Region_Free (
65  Region_Control *the_region
66)
67{
68  _Thread_queue_Destroy( &the_region->Wait_queue );
69  _Objects_Free( &_Region_Information, &the_region->Object );
70}
71
72RTEMS_INLINE_ROUTINE Region_Control *_Region_Get_and_lock( Objects_Id id )
73{
74  Region_Control *the_region;
75
76  _RTEMS_Lock_allocator();
77
78  the_region = (Region_Control *)
79    _Objects_Get_no_protection( id, &_Region_Information );
80
81  if ( the_region != NULL ) {
82    /* Keep allocator lock */
83    return the_region;
84  }
85
86  _RTEMS_Unlock_allocator();
87  return NULL;
88}
89
90RTEMS_INLINE_ROUTINE void _Region_Unlock( Region_Control *the_region )
91{
92  (void) the_region;
93  _RTEMS_Unlock_allocator();
94}
95
96/**
97 *  @brief Region_Allocate_segment
98 *
99 *  This function attempts to allocate a segment from the_region.
100 *  If successful, it returns the address of the allocated segment.
101 *  Otherwise, it returns NULL.
102 */
103RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment (
104  Region_Control *the_region,
105  uintptr_t       size
106)
107{
108  return _Heap_Allocate( &the_region->Memory, size );
109}
110
111/**
112 *  @brief Region_Free_segment
113 *
114 *  This function frees the_segment to the_region.
115 */
116RTEMS_INLINE_ROUTINE bool _Region_Free_segment (
117  Region_Control *the_region,
118  void           *the_segment
119)
120{
121  return _Heap_Free( &the_region->Memory, the_segment );
122}
123
124/**
125 *  @brief Process Region Queue
126 *
127 *  This is a helper routine which is invoked any time memory is
128 *  freed.  It looks at the set of waiting tasks and attempts to
129 *  satisfy all outstanding requests.
130 *
131 *  @param[in] the_region is the the region
132 */
133extern void _Region_Process_queue(Region_Control *the_region);
134
135/**@}*/
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif
142/* end of include file */
Note: See TracBrowser for help on using the repository browser.