source: rtems/cpukit/include/rtems/rtems/semimpl.h @ e8e914b3

5
Last change on this file since e8e914b3 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

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: 2.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicSem
5 *
6 * @brief Classic Semaphores 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_SEMIMPL_H
18#define _RTEMS_RTEMS_SEMIMPL_H
19
20#include <rtems/rtems/sem.h>
21#include <rtems/score/coremuteximpl.h>
22#include <rtems/score/coresemimpl.h>
23#include <rtems/score/mrspimpl.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 * @brief Classic semaphore variants.
31 *
32 * Must be in synchronization with Semaphore_Control::variant.
33 */
34typedef enum {
35  SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY,
36  SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING,
37  SEMAPHORE_VARIANT_MUTEX_NO_PROTOCOL,
38  SEMAPHORE_VARIANT_SIMPLE_BINARY,
39  SEMAPHORE_VARIANT_COUNTING
40#if defined(RTEMS_SMP)
41  ,
42  SEMAPHORE_VARIANT_MRSP
43#endif
44} Semaphore_Variant;
45
46typedef enum {
47  SEMAPHORE_DISCIPLINE_PRIORITY,
48  SEMAPHORE_DISCIPLINE_FIFO
49} Semaphore_Discipline;
50
51/**
52 *  The following defines the information control block used to manage
53 *  this class of objects.
54 */
55extern Objects_Information _Semaphore_Information;
56
57RTEMS_INLINE_ROUTINE const Thread_queue_Operations *_Semaphore_Get_operations(
58  const Semaphore_Control *the_semaphore
59)
60{
61  if ( the_semaphore->variant == SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY ) {
62    return &_Thread_queue_Operations_priority_inherit;
63  }
64
65  if ( the_semaphore->discipline == SEMAPHORE_DISCIPLINE_PRIORITY ) {
66    return &_Thread_queue_Operations_priority;
67  }
68
69  return &_Thread_queue_Operations_FIFO;
70}
71
72/**
73 *  @brief Allocates a semaphore control block from
74 *  the inactive chain of free semaphore control blocks.
75 *
76 *  This function allocates a semaphore control block from
77 *  the inactive chain of free semaphore control blocks.
78 */
79RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Allocate( void )
80{
81  return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
82}
83
84/**
85 *  @brief Frees a semaphore control block to the
86 *  inactive chain of free semaphore control blocks.
87 *
88 *  This routine frees a semaphore control block to the
89 *  inactive chain of free semaphore control blocks.
90 */
91RTEMS_INLINE_ROUTINE void _Semaphore_Free (
92  Semaphore_Control *the_semaphore
93)
94{
95  _Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
96}
97
98RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get(
99  Objects_Id            id,
100  Thread_queue_Context *queue_context
101)
102{
103  _Thread_queue_Context_initialize( queue_context );
104  return (Semaphore_Control *) _Objects_Get(
105    id,
106    &queue_context->Lock_context.Lock_context,
107    &_Semaphore_Information
108  );
109}
110
111#ifdef __cplusplus
112}
113#endif
114
115#ifdef RTEMS_MULTIPROCESSING
116#include <rtems/rtems/semmp.h>
117#endif
118
119#endif
120/*  end of include file */
Note: See TracBrowser for help on using the repository browser.