source: rtems/cpukit/include/rtems/rtems/barrierimpl.h @ 21275b58

Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 22, 2018 at 6:14:51 PM

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicBarrierImpl
5 *
6 * @brief Classic Barrier Manager Implementation
7 */
8
9/*
10 * COPYRIGHT (c) 1989-2008.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_RTEMS_BARRIERIMPL_H
19#define _RTEMS_RTEMS_BARRIERIMPL_H
20
21#include <rtems/rtems/barrierdata.h>
22#include <rtems/score/corebarrierimpl.h>
23#include <rtems/score/objectimpl.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 *  @defgroup ClassicBarrierImpl Classic Barrier Implementation
31 *
32 *  @ingroup ClassicBarrier
33 *
34 *  @{
35 */
36
37/**
38 *  @brief _Barrier_Allocate
39 *
40 *  This function allocates a barrier control block from
41 *  the inactive chain of free barrier control blocks.
42 */
43RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Allocate( void )
44{
45  return (Barrier_Control *) _Objects_Allocate( &_Barrier_Information );
46}
47
48/**
49 *  @brief _Barrier_Free
50 *
51 *  This routine frees a barrier control block to the
52 *  inactive chain of free barrier control blocks.
53 */
54RTEMS_INLINE_ROUTINE void _Barrier_Free (
55  Barrier_Control *the_barrier
56)
57{
58  _CORE_barrier_Destroy( &the_barrier->Barrier );
59  _Objects_Free( &_Barrier_Information, &the_barrier->Object );
60}
61
62RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get(
63  Objects_Id            id,
64  Thread_queue_Context *queue_context
65)
66{
67  _Thread_queue_Context_initialize( queue_context );
68  return (Barrier_Control *) _Objects_Get(
69    id,
70    &queue_context->Lock_context.Lock_context,
71    &_Barrier_Information
72  );
73}
74
75/**@}*/
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif
82/*  end of include file */
Note: See TracBrowser for help on using the repository browser.