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

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: 4.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicRateMonImpl
5 *
6 * @brief Classic Rate Monotonic Scheduler Implementation
7 */
8
9/*  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright (c) 2016 embedded brains GmbH.
12 *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
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_RTEMS_RATEMONIMPL_H
20#define _RTEMS_RTEMS_RATEMONIMPL_H
21
22#include <rtems/rtems/ratemon.h>
23#include <rtems/score/objectimpl.h>
24#include <rtems/score/schedulerimpl.h>
25#include <rtems/score/threadimpl.h>
26#include <rtems/score/watchdogimpl.h>
27
28#include <string.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/**
35 * @defgroup ClassicRateMonImpl Classic Rate Monotonic Scheduler Implementation
36 *
37 * @ingroup ClassicRateMon
38 *
39 * @{
40 */
41
42#define RATE_MONOTONIC_INTEND_TO_BLOCK \
43  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_INTEND_TO_BLOCK )
44
45#define RATE_MONOTONIC_BLOCKED \
46  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_BLOCKED )
47
48#define RATE_MONOTONIC_READY_AGAIN \
49  ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_READY_AGAIN )
50
51/**
52 *  @brief Rate Monotonic Period Class Management Structure
53 *
54 *  This instance of Objects_Information is used to manage the
55 *  set of rate monotonic period instances.
56 */
57extern Objects_Information _Rate_monotonic_Information;
58
59/**
60 *  @brief Allocates a period control block from
61 *  the inactive chain of free period control blocks.
62 *
63 *  This function allocates a period control block from
64 *  the inactive chain of free period control blocks.
65 */
66RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
67{
68  return (Rate_monotonic_Control *)
69    _Objects_Allocate( &_Rate_monotonic_Information );
70}
71
72RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical(
73  Rate_monotonic_Control *the_period,
74  ISR_lock_Context       *lock_context
75)
76{
77  _ISR_lock_Acquire( &the_period->Lock, lock_context );
78}
79
80RTEMS_INLINE_ROUTINE void _Rate_monotonic_Release(
81  Rate_monotonic_Control *the_period,
82  ISR_lock_Context       *lock_context
83)
84{
85  _ISR_lock_Release_and_ISR_enable( &the_period->Lock, lock_context );
86}
87
88RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get(
89  Objects_Id        id,
90  ISR_lock_Context *lock_context
91)
92{
93  return (Rate_monotonic_Control *)
94    _Objects_Get( id, lock_context, &_Rate_monotonic_Information );
95}
96
97void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
98
99/**
100 * @brief _Rate_monotonic_Get_status(
101 *
102 * This routine is invoked to compute the elapsed wall time and cpu
103 * time for a period.
104 *
105 * @param[in] the_period points to the period being operated upon.
106 * @param[out] wall_since_last_period is set to the wall time elapsed
107 *             since the period was initiated.
108 * @param[out] cpu_since_last_period is set to the cpu time used by the
109 *             owning thread since the period was initiated.
110 *
111 * @retval This routine returns true if the status can be determined
112 *         and false otherwise.
113 */
114bool _Rate_monotonic_Get_status(
115  const Rate_monotonic_Control *the_period,
116  Timestamp_Control            *wall_since_last_period,
117  Timestamp_Control            *cpu_since_last_period
118);
119
120void _Rate_monotonic_Restart(
121  Rate_monotonic_Control *the_period,
122  Thread_Control         *owner,
123  ISR_lock_Context       *lock_context
124);
125
126void _Rate_monotonic_Cancel(
127  Rate_monotonic_Control *the_period,
128  Thread_Control         *owner,
129  ISR_lock_Context       *lock_context
130);
131
132RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_min_time(
133  Timestamp_Control *min_time
134)
135{
136  _Timestamp_Set( min_time, 0x7fffffff, 0x7fffffff );
137}
138
139RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_statistics(
140  Rate_monotonic_Control *the_period
141)
142{
143  Rate_monotonic_Statistics *statistics;
144
145  statistics = &the_period->Statistics;
146  memset( statistics, 0, sizeof( *statistics ) );
147  _Rate_monotonic_Reset_min_time( &statistics->min_wall_time );
148  _Rate_monotonic_Reset_min_time( &statistics->min_cpu_time );
149}
150
151/**@}*/
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif
158/* end of include file */
Note: See TracBrowser for help on using the repository browser.