source: rtems/cpukit/include/rtems/score/corerwlockimpl.h @ 878487b0

5
Last change on this file since 878487b0 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: 4.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the SuperCore RWLock
5 *
6 * This include file contains all of the inlined routines associated
7 * with the SuperCore RWLock.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2008.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_CORERWLOCKIMPL_H
20#define _RTEMS_SCORE_CORERWLOCKIMPL_H
21
22#include <rtems/score/percpu.h>
23#include <rtems/score/status.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/threadqimpl.h>
26#include <rtems/score/watchdog.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * @addtogroup ScoreRWLock
34 */
35/**@{**/
36
37#define CORE_RWLOCK_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
38
39/**
40 *  This is used to denote that a thread is blocking waiting for
41 *  read-only access to the RWLock.
42 */
43#define CORE_RWLOCK_THREAD_WAITING_FOR_READ  0
44
45/**
46 *  This is used to denote that a thread is blocking waiting for
47 *  write-exclusive access to the RWLock.
48 */
49#define CORE_RWLOCK_THREAD_WAITING_FOR_WRITE 1
50
51/**
52 *  RWLock State.
53 */
54typedef enum {
55  /** This indicates the the RWLock is not currently locked.
56   */
57  CORE_RWLOCK_UNLOCKED,
58  /** This indicates the the RWLock is currently locked for reading.
59   */
60  CORE_RWLOCK_LOCKED_FOR_READING,
61  /** This indicates the the RWLock is currently locked for reading.
62   */
63  CORE_RWLOCK_LOCKED_FOR_WRITING
64}   CORE_RWLock_States;
65
66/**
67 *  The following defines the control block used to manage each
68 *  RWLock.
69 */
70typedef struct {
71  /** This field is the Waiting Queue used to manage the set of tasks
72   *  which are blocked waiting for the RWLock to be released.
73   */
74  Thread_queue_Syslock_queue Queue;
75
76  /** This element is the current state of the RWLock.
77   */
78  CORE_RWLock_States current_state;
79
80  /** This element contains the current number of thread waiting for this
81   *  RWLock to be released. */
82  unsigned int number_of_readers;
83}   CORE_RWLock_Control;
84
85/**
86 *  @brief Initialize a RWlock.
87 *
88 *  This routine initializes the RWLock based on the parameters passed.
89 *
90 *  @param[in] the_rwlock is the RWLock to initialize
91 */
92void _CORE_RWLock_Initialize(
93  CORE_RWLock_Control *the_rwlock
94);
95
96RTEMS_INLINE_ROUTINE void _CORE_RWLock_Destroy(
97  CORE_RWLock_Control *the_rwlock
98)
99{
100  (void) the_rwlock;
101}
102
103RTEMS_INLINE_ROUTINE Thread_Control *_CORE_RWLock_Acquire(
104  CORE_RWLock_Control  *the_rwlock,
105  Thread_queue_Context *queue_context
106)
107{
108  ISR_Level       level;
109  Thread_Control *executing;
110
111  _Thread_queue_Context_ISR_disable( queue_context, level );
112  _Thread_queue_Context_set_ISR_level( queue_context, level );
113  executing = _Thread_Executing;
114  _Thread_queue_Queue_acquire_critical(
115    &the_rwlock->Queue.Queue,
116    &executing->Potpourri_stats,
117    &queue_context->Lock_context.Lock_context
118  );
119
120  return executing;
121}
122
123RTEMS_INLINE_ROUTINE void _CORE_RWLock_Release(
124  CORE_RWLock_Control  *the_rwlock,
125  Thread_queue_Context *queue_context
126)
127{
128  _Thread_queue_Queue_release(
129    &the_rwlock->Queue.Queue,
130    &queue_context->Lock_context.Lock_context
131  );
132}
133
134/**
135 *  @brief Obtain RWLock for reading.
136 *
137 *  This routine attempts to obtain the RWLock for read access.
138 *
139 *  @param[in] the_rwlock is the RWLock to wait for
140 *  @param[in] wait is true if the calling thread is willing to wait
141 */
142
143Status_Control _CORE_RWLock_Seize_for_reading(
144  CORE_RWLock_Control  *the_rwlock,
145  bool                  wait,
146  Thread_queue_Context *queue_context
147);
148
149/**
150 *  @brief Obtain RWLock for writing.
151 *
152 *  This routine attempts to obtain the RWLock for write exclusive access.
153 *
154 *  @param[in] the_rwlock is the RWLock to wait for
155 *  @param[in] wait is true if the calling thread is willing to wait
156 */
157Status_Control _CORE_RWLock_Seize_for_writing(
158  CORE_RWLock_Control  *the_rwlock,
159  bool                  wait,
160  Thread_queue_Context *queue_context
161);
162
163/**
164 *  @brief Release the RWLock.
165 *
166 *  This routine manually releases @a the_rwlock.  All of the threads waiting
167 *  for the RWLock will be readied.
168 *
169 *  @param[in] the_rwlock is the RWLock to surrender
170 *
171 *  @retval Status is returned to indicate successful or failure.
172 */
173Status_Control _CORE_RWLock_Surrender( CORE_RWLock_Control *the_rwlock );
174
175/** @} */
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif
182/* end of include file */
Note: See TracBrowser for help on using the repository browser.