source: rtems/cpukit/include/rtems/score/corebarrierimpl.h @ 5803f37

5
Last change on this file since 5803f37 was accbe670, checked in by Andreas Dachsberger <andreas.dachsberger@…>, on 04/05/19 at 08:59:58

doxygen: score: adjust doc in corebarrierimpl.h to doxygen guidelines

Update #3706.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSScoreBarrier
5 *
6 * @brief Inlined Routines Associated with the SuperCore Barrier
7 *
8 * This include file contains all of the inlined routines associated
9 * with the SuperCore barrier.
10 */
11
12/*
13 *  COPYRIGHT (c) 1989-2006.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_SCORE_COREBARRIERIMPL_H
22#define _RTEMS_SCORE_COREBARRIERIMPL_H
23
24#include <rtems/score/corebarrier.h>
25#include <rtems/score/status.h>
26#include <rtems/score/threadqimpl.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * @addtogroup RTEMSScoreBarrier
34 *
35 * @{
36 */
37
38#define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
39
40/**
41 *  @brief Initializes the core barrier.
42 *
43 *  This routine initializes the barrier based on the parameters passed.
44 *
45 *  @param[out] the_barrier The barrier to initialize.
46 *  @param[out] the_barrier_attributes The attributes which define the behavior of this instance.
47 */
48void _CORE_barrier_Initialize(
49  CORE_barrier_Control       *the_barrier,
50  CORE_barrier_Attributes    *the_barrier_attributes
51);
52
53/**
54 * @brief Destroys the core barrier.
55 *
56 * This routine destroys the barrier.
57 *
58 * @param[out] the_barrier The barrier to destroy.
59 */
60RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
61  CORE_barrier_Control *the_barrier
62)
63{
64  _Thread_queue_Destroy( &the_barrier->Wait_queue );
65}
66
67/**
68 * @brief Acquires critical core barrier.
69 *
70 * @param[in, out] the_barrier The barrier to acquire.
71 * @param queue_context The thread queue context.
72 */
73RTEMS_INLINE_ROUTINE void _CORE_barrier_Acquire_critical(
74  CORE_barrier_Control *the_barrier,
75  Thread_queue_Context *queue_context
76)
77{
78  _Thread_queue_Acquire_critical( &the_barrier->Wait_queue, queue_context );
79}
80
81/**
82 * @brief Releases core barrier.
83 *
84 * @param[in, out] the_barrier The barrier to release.
85 * @param queue_context The thread queue context.
86 */
87RTEMS_INLINE_ROUTINE void _CORE_barrier_Release(
88  CORE_barrier_Control *the_barrier,
89  Thread_queue_Context *queue_context
90)
91{
92  _Thread_queue_Release( &the_barrier->Wait_queue, queue_context );
93}
94
95/**
96 * @brief Waits for the barrier.
97 *
98 * This routine waits for the barrier to be released.  If the barrier
99 * is set to automatic and this is the appropriate thread, then it returns
100 * immediately.  Otherwise, the calling thread is blocked until the barrier
101 * is released.
102 *
103 * @param[in, out] the_barrier The barrier to wait for.
104 * @param[in, out] executing The currently executing thread.
105 * @param wait This parameter is true if the calling thread is willing to wait.
106 * @param queue_context The thread queue context.
107 *
108 * @return The method status.
109 */
110Status_Control _CORE_barrier_Seize(
111  CORE_barrier_Control *the_barrier,
112  Thread_Control       *executing,
113  bool                  wait,
114  Thread_queue_Context *queue_context
115);
116
117/**
118 * @brief Flushes the barrier.
119 *
120 * @param[in, out] the_barrier The barrier to flush.
121 * @param[out] filter The filter for flushing.
122 * @param[out] queue_context The thread queue context.
123 */
124uint32_t _CORE_barrier_Do_flush(
125  CORE_barrier_Control      *the_barrier,
126  Thread_queue_Flush_filter  filter,
127  Thread_queue_Context      *queue_context
128);
129
130/**
131 * @brief Manually releases the barrier.
132 *
133 * This routine manually releases the barrier.  All of the threads waiting
134 * for the barrier will be readied.
135 *
136 * @param[in, out] the_barrier The barrier to surrender.
137 * @param[out] queue_context The thread queue context.
138 *
139 * @return The number of unblocked threads.
140 */
141RTEMS_INLINE_ROUTINE uint32_t _CORE_barrier_Surrender(
142  CORE_barrier_Control *the_barrier,
143  Thread_queue_Context *queue_context
144)
145{
146  return _CORE_barrier_Do_flush(
147    the_barrier,
148    _Thread_queue_Flush_default_filter,
149    queue_context
150  );
151}
152
153/**
154 * @brief Flushes the barrier using _CORE_barrier_Do_flush().
155 *
156 * @param[in, out] the_barrier The barrier to flush.
157 * @param queue_context The thread queue context.
158 */
159RTEMS_INLINE_ROUTINE void _CORE_barrier_Flush(
160  CORE_barrier_Control *the_barrier,
161  Thread_queue_Context *queue_context
162)
163{
164  _CORE_barrier_Do_flush(
165    the_barrier,
166    _Thread_queue_Flush_status_object_was_deleted,
167    queue_context
168  );
169}
170
171/**
172 * @brief Checks if the barrier is automatic.
173 *
174 * This function returns true if the automatic release attribute is
175 * enabled in the @a attribute_set and false otherwise.
176 *
177 * @param the_attribute The attribute set to test.
178 *
179 * @retval true The automatic release attribute is enabled.
180 * @retval false The automatic release attribute is not enabled.
181 */
182RTEMS_INLINE_ROUTINE bool _CORE_barrier_Is_automatic(
183  CORE_barrier_Attributes *the_attribute
184)
185{
186   return
187     (the_attribute->discipline == CORE_BARRIER_AUTOMATIC_RELEASE);
188}
189
190/**
191 * @brief Returns the number of currently waiting threads.
192 *
193 * This routine returns the number of threads currently waiting at the barrier.
194 *
195 * @param[in] the_barrier The barrier to obtain the number of blocked
196 *            threads of.
197 *
198 * @return the current count of waiting threads of this barrier.
199 */
200RTEMS_INLINE_ROUTINE uint32_t  _CORE_barrier_Get_number_of_waiting_threads(
201  CORE_barrier_Control  *the_barrier
202)
203{
204  return the_barrier->number_of_waiting_threads;
205}
206
207/** @} */
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif
214/* end of include file */
Note: See TracBrowser for help on using the repository browser.