RTEMS
barriercreate.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2006.
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 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
23 #include <rtems/rtems/status.h>
24 #include <rtems/rtems/support.h>
25 #include <rtems/rtems/attrimpl.h>
26 #include <rtems/score/isr.h>
27 #include <rtems/sysinit.h>
28 
30  rtems_name name,
31  rtems_attribute attribute_set,
32  uint32_t maximum_waiters,
33  rtems_id *id
34 )
35 {
36  Barrier_Control *the_barrier;
37  CORE_barrier_Attributes the_attributes;
38 
39  if ( !rtems_is_name_valid( name ) )
40  return RTEMS_INVALID_NAME;
41 
42  if ( !id )
43  return RTEMS_INVALID_ADDRESS;
44 
45  /* Initialize core barrier attributes */
46  if ( _Attributes_Is_barrier_automatic( attribute_set ) ) {
48  if ( maximum_waiters == 0 )
49  return RTEMS_INVALID_NUMBER;
50  } else
51  the_attributes.discipline = CORE_BARRIER_MANUAL_RELEASE;
52  the_attributes.maximum_count = maximum_waiters;
53 
54  the_barrier = _Barrier_Allocate();
55 
56  if ( !the_barrier ) {
58  return RTEMS_TOO_MANY;
59  }
60 
61  the_barrier->attribute_set = attribute_set;
62 
63  _CORE_barrier_Initialize( &the_barrier->Barrier, &the_attributes );
64 
67  &the_barrier->Object,
68  (Objects_Name) name
69  );
70 
71  *id = the_barrier->Object.id;
72 
74  return RTEMS_SUCCESSFUL;
75 }
76 
77 static void _Barrier_Manager_initialization( void )
78 {
80 }
81 
82 RTEMS_SYSINIT_ITEM(
83  _Barrier_Manager_initialization,
84  RTEMS_SYSINIT_CLASSIC_BARRIER,
85  RTEMS_SYSINIT_ORDER_MIDDLE
86 );
This status code indicates you have attempted to create too many instances of a particular object cla...
Definition: status.h:112
static __inline__ void _Objects_Allocator_unlock(void)
Unlocks the object allocator mutex.
Definition: objectimpl.h:846
This header file defines support services of the API.
Objects_Control Object
Definition: barrierdata.h:40
void _CORE_barrier_Initialize(CORE_barrier_Control *the_barrier, CORE_barrier_Attributes *the_barrier_attributes)
Initializes the core barrier.
Definition: corebarrier.c:23
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
Data Related to the Management of Processor Interrupt Levels.
void _Objects_Initialize_information(Objects_Information *information)
Initializes the specified objects information.
Objects_Information _Barrier_Information
The Classic Barrier objects information.
Definition: barrier.c:47
static bool rtems_is_name_valid(rtems_status_code name)
Returns true, if the specified object name is valid, otherwise returns false.
Definition: support.h:126
rtems_status_code rtems_barrier_create(rtems_name name, rtems_attribute attribute_set, uint32_t maximum_waiters, rtems_id *id)
%
Definition: barriercreate.c:29
This status code indicates that a specified number was invalid.
Definition: status.h:138
rtems_attribute attribute_set
Definition: barrierdata.h:44
This header file defines the status codes and support functions of the Classic API.
This status code indicates successful completion.
Definition: status.h:86
static __inline__ void _Objects_Open(Objects_Information *information, Objects_Control *the_object, Objects_Name name)
Places the_object control pointer and object name in the Local Pointer and Local Name Tables...
Definition: objectimpl.h:750
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
static __inline__ Barrier_Control * _Barrier_Allocate(void)
_Barrier_Allocate
Definition: barrierimpl.h:43
RTEMS_INLINE_ROUTINE bool _Attributes_Is_barrier_automatic(rtems_attribute attribute_set)
Checks if the barrier automatic release attribute is enabled in the attribute_set.
Definition: attrimpl.h:235
This status code indicates that a specified address was invalid.
Definition: status.h:133
uint32_t rtems_attribute
This type is used to represent Classic API attributes.
Definition: attr.h:91
Classic Attributes Implementation.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
CORE_barrier_Control Barrier
Definition: barrierdata.h:42
This status code indicates that an object name was invalid.
Definition: status.h:101
Classic Barrier Manager Implementation.
CORE_barrier_Disciplines discipline
Definition: corebarrier.h:64
Objects_Id id
Definition: objectdata.h:43