source: rtems/cpukit/rtems/include/rtems/rtems/sem.h @ 067a96a

4.104.114.95
Last change on this file since 067a96a was 067a96a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/18/08 at 15:02:20

2008-04-18 Joel Sherrill <joel.sherrill@…>

  • rtems/include/rtems.h, rtems/include/rtems/rtems/asr.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/barriermp.h, rtems/include/rtems/rtems/cache.h, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/config.h, rtems/include/rtems/rtems/dpmem.h, rtems/include/rtems/rtems/event.h, rtems/include/rtems/rtems/eventmp.h, rtems/include/rtems/rtems/eventset.h, rtems/include/rtems/rtems/intr.h, rtems/include/rtems/rtems/message.h, rtems/include/rtems/rtems/modes.h, rtems/include/rtems/rtems/mp.h, rtems/include/rtems/rtems/msgmp.h, rtems/include/rtems/rtems/object.h, rtems/include/rtems/rtems/options.h, rtems/include/rtems/rtems/part.h, rtems/include/rtems/rtems/partmp.h, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/region.h, rtems/include/rtems/rtems/regionmp.h, rtems/include/rtems/rtems/rtemsapi.h, rtems/include/rtems/rtems/sem.h, rtems/include/rtems/rtems/semmp.h, rtems/include/rtems/rtems/signal.h, rtems/include/rtems/rtems/signalmp.h, rtems/include/rtems/rtems/status.h, rtems/include/rtems/rtems/support.h, rtems/include/rtems/rtems/taskmp.h, rtems/include/rtems/rtems/tasks.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/inline/rtems/rtems/asr.inl, rtems/inline/rtems/rtems/attr.inl, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/dpmem.inl, rtems/inline/rtems/rtems/event.inl, rtems/inline/rtems/rtems/eventset.inl, rtems/inline/rtems/rtems/message.inl, rtems/inline/rtems/rtems/modes.inl, rtems/inline/rtems/rtems/options.inl, rtems/inline/rtems/rtems/part.inl, rtems/inline/rtems/rtems/ratemon.inl, rtems/inline/rtems/rtems/region.inl, rtems/inline/rtems/rtems/sem.inl, rtems/inline/rtems/rtems/status.inl, rtems/inline/rtems/rtems/support.inl, rtems/inline/rtems/rtems/tasks.inl, rtems/inline/rtems/rtems/timer.inl: Initial conversion of Classic API header files to Doxygen.
  • rtems/Doxyfile: New file.
  • Property mode set to 100644
File size: 5.5 KB
Line 
1/**
2 * @file rtems/rtems/sem.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the Semaphore Manager.  This manager utilizes standard Dijkstra
6 *  counting semaphores to provide synchronization and mutual exclusion
7 *  capabilities.
8 *
9 *  Directives provided are:
10 *
11 *     - create a semaphore
12 *     - get an ID of a semaphore
13 *     - delete a semaphore
14 *     - acquire a semaphore
15 *     - release a semaphore
16 */
17
18/*  COPYRIGHT (c) 1989-2007.
19 *  On-Line Applications Research Corporation (OAR).
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.rtems.com/license/LICENSE.
24 *
25 *  $Id$
26 */
27
28#ifndef _RTEMS_RTEMS_SEM_H
29#define _RTEMS_RTEMS_SEM_H
30
31#ifndef RTEMS_SEM_EXTERN
32#define RTEMS_SEM_EXTERN extern
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include <rtems/rtems/types.h>
40#include <rtems/rtems/support.h>
41#include <rtems/rtems/tasks.h>
42#include <rtems/rtems/attr.h>
43#include <rtems/score/coremutex.h>
44#include <rtems/score/object.h>
45#include <rtems/score/coresem.h>
46
47/**
48 *  @defgroup ClassicSem Classic API Semaphore
49 *
50 *  This encapsulates functionality which XXX
51 */
52/**@{*/
53
54/**
55 *  The following defines the control block used to manage each semaphore.
56 */
57typedef struct {
58  Objects_Control          Object;
59  rtems_attribute          attribute_set;
60  union {
61    CORE_mutex_Control     mutex;
62    CORE_semaphore_Control semaphore;
63  } Core_control;
64}   Semaphore_Control;
65
66/**
67 *  The following defines the information control block used to manage
68 *  this class of objects.
69 */
70RTEMS_SEM_EXTERN Objects_Information  _Semaphore_Information;
71
72/**
73 *  @brief Semaphore_Manager_initialization
74 *
75 *  This routine performs the initialization necessary for this manager.
76 */
77void _Semaphore_Manager_initialization(
78  uint32_t   maximum_semaphores
79);
80
81/**
82 *  @brief rtems_semaphore_create
83 *
84 *  This routine implements the rtems_semaphore_create directive.  The
85 *  semaphore will have the name name.  The starting count for
86 *  the semaphore is count.  The attribute_set determines if
87 *  the semaphore is global or local and the thread queue
88 *  discipline.  It returns the id of the created semaphore in ID.
89 */
90rtems_status_code rtems_semaphore_create(
91  rtems_name           name,
92  uint32_t             count,
93  rtems_attribute      attribute_set,
94  rtems_task_priority  priority_ceiling,
95  rtems_id            *id
96);
97
98/**
99 *  @brief rtems_semaphore_ident
100 *
101 *  This routine implements the rtems_semaphore_ident directive.
102 *  This directive returns the semaphore ID associated with name.
103 *  If more than one semaphore is named name, then the semaphore
104 *  to which the ID belongs is arbitrary.  node indicates the
105 *  extent of the search for the ID of the semaphore named name.
106 *  The search can be limited to a particular node or allowed to
107 *  encompass all nodes.
108 */
109rtems_status_code rtems_semaphore_ident(
110  rtems_name    name,
111  uint32_t      node,
112  rtems_id     *id
113);
114
115/**
116 *  @brief rtems_semaphore_delete
117 *
118 *  This routine implements the rtems_semaphore_delete directive.  The
119 *  semaphore indicated by ID is deleted.
120 */
121rtems_status_code rtems_semaphore_delete(
122  rtems_id   id
123);
124
125/**
126 *  @brief rtems_semaphore_obtain
127 *
128 *  This routine implements the rtems_semaphore_obtain directive.  It
129 *  attempts to obtain a unit from the semaphore associated with ID.
130 *  If a unit can be allocated, the calling task will return immediately.
131 *  If no unit is available, then the task may return immediately or
132 *  block waiting for a unit with an optional timeout of timeout
133 *  clock ticks.  Whether the task blocks or returns immediately
134 *  is based on the RTEMS_NO_WAIT option in the option_set.
135 */
136rtems_status_code rtems_semaphore_obtain(
137  rtems_id       id,
138  uint32_t       option_set,
139  rtems_interval timeout
140);
141
142/**
143 *  @brief rtems_semaphore_release
144 *
145 *  This routine implements the rtems_semaphore_release directive.  It
146 *  frees a unit to the semaphore associated with ID.  If a task was
147 *  blocked waiting for a unit from this semaphore, then that task will
148 *  be readied and the unit given to that task.  Otherwise, the unit
149 *  will be returned to the semaphore.
150 */
151rtems_status_code rtems_semaphore_release(
152  rtems_id   id
153);
154
155/**
156 *  @brief rtems_semaphore_flush
157 *  pending on the semaphore.
158 */
159rtems_status_code rtems_semaphore_flush(
160  rtems_id         id
161);
162
163/**
164 *  @brief _Semaphore_Seize
165 *
166 *  This routine attempts to receive a unit from the_semaphore.
167 *  If a unit is available or if the RTEMS_NO_WAIT option is enabled in
168 *  option_set, then the routine returns.  Otherwise, the calling task
169 *  is blocked until a unit becomes available.
170 */
171boolean _Semaphore_Seize(
172  Semaphore_Control *the_semaphore,
173  uint32_t           option_set
174);
175
176/**
177 *  @brief _Semaphore_Translate_core_mutex_return_code
178 *
179 *  This function returns a RTEMS status code based on the mutex
180 *  status code specified.
181 */
182rtems_status_code _Semaphore_Translate_core_mutex_return_code (
183  uint32_t   the_mutex_status
184);
185
186/**
187 *  @brief _Semaphore_Translate_core_semaphore_return_code
188 *
189 *  This function returns a RTEMS status code based on the semaphore
190 *  status code specified.
191 */
192rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
193  uint32_t   the_mutex_status
194);
195
196#ifndef __RTEMS_APPLICATION__
197#include <rtems/rtems/sem.inl>
198#endif
199#if defined(RTEMS_MULTIPROCESSING)
200#include <rtems/rtems/semmp.h>
201#endif
202
203#ifdef __cplusplus
204}
205#endif
206
207/**@}*/
208
209#endif
210/*  end of include file */
Note: See TracBrowser for help on using the repository browser.