source: rtems/cpukit/score/include/rtems/score/coresem.h @ 3a4ae6c

4.104.114.84.95
Last change on this file since 3a4ae6c was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*  core_sem.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Counting Semaphore Handler.  A counting semaphore is the
5 *  standard Dijkstra binary semaphore used to provide synchronization
6 *  and mutual exclusion capabilities.
7 *
8 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
9 *  On-Line Applications Research Corporation (OAR).
10 *  All rights assigned to U.S. Government, 1994.
11 *
12 *  This material may be reproduced by or for the U.S. Government pursuant
13 *  to the copyright license under the clause at DFARS 252.227-7013.  This
14 *  notice must appear in all copies of this file and its derivatives.
15 *
16 *  $Id$
17 */
18 
19#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h
20#define __RTEMS_CORE_COUNTING_SEMAPHORE_h
21 
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <rtems/core/thread.h>
27#include <rtems/core/threadq.h>
28#include <rtems/core/priority.h>
29#include <rtems/core/watchdog.h>
30 
31/*
32 *  The following type defines the callout which the API provides
33 *  to support global/multiprocessor operations on semaphores.
34 */
35 
36typedef void ( *CORE_semaphore_API_mp_support_callout )(
37                 Thread_Control *,
38                 Objects_Id
39             );
40
41/*
42 *  Blocking disciplines for a semaphore.
43 */
44
45typedef enum {
46  CORE_SEMAPHORE_DISCIPLINES_FIFO,
47  CORE_SEMAPHORE_DISCIPLINES_PRIORITY
48}   CORE_semaphore_Disciplines;
49
50/*
51 *  Core Semaphore handler return statuses.
52 */
53 
54typedef enum {
55  CORE_SEMAPHORE_STATUS_SUCCESSFUL,
56  CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
57  CORE_SEMAPHORE_WAS_DELETED,
58  CORE_SEMAPHORE_TIMEOUT
59}   CORE_semaphore_Status;
60
61/*
62 *  The following defines the control block used to manage the
63 *  attributes of each semaphore.
64 */
65
66typedef struct {
67  CORE_semaphore_Disciplines  discipline;
68}   CORE_semaphore_Attributes;
69 
70/*
71 *  The following defines the control block used to manage each
72 *  counting semaphore.
73 */
74 
75typedef struct {
76  Thread_queue_Control        Wait_queue;
77  CORE_semaphore_Attributes   Attributes;
78  unsigned32                  count;
79}   CORE_semaphore_Control;
80
81/*
82 *  _CORE_semaphore_Initialize
83 *
84 *  DESCRIPTION:
85 *
86 *  This routine initializes the semaphore based on the parameters passed.
87 */
88
89void _CORE_semaphore_Initialize(
90  CORE_semaphore_Control       *the_semaphore,
91  Objects_Classes               the_class,
92  CORE_semaphore_Attributes    *the_semaphore_attributes,
93  unsigned32                    initial_value,
94  Thread_queue_Extract_callout  proxy_extract_callout
95);
96 
97/*
98 *  _CORE_semaphore_Seize
99 *
100 *  DESCRIPTION:
101 *
102 *  This routine attempts to receive a unit from the_semaphore.
103 *  If a unit is available or if the wait flag is FALSE, then the routine
104 *  returns.  Otherwise, the calling task is blocked until a unit becomes
105 *  available.
106 */
107
108void _CORE_semaphore_Seize(
109  CORE_semaphore_Control  *the_semaphore,
110  Objects_Id               id,
111  boolean                  wait,
112  Watchdog_Interval        timeout
113);
114 
115/*
116 *  _CORE_semaphore_Surrender
117 *
118 *  DESCRIPTION:
119 *
120 *  This routine frees a unit to the semaphore.  If a task was blocked waiting
121 *  for a unit from this semaphore, then that task will be readied and the unit
122 *  given to that task.  Otherwise, the unit will be returned to the semaphore.
123 */
124
125CORE_semaphore_Status _CORE_semaphore_Surrender(
126  CORE_semaphore_Control                *the_semaphore,
127  Objects_Id                             id,
128  CORE_semaphore_API_mp_support_callout  api_semaphore_mp_support
129);
130 
131/*
132 *  _CORE_semaphore_Flush
133 *
134 *  DESCRIPTION:
135 *
136 *  This routine assists in the deletion of a semaphore by flushing the
137 *  associated wait queue.
138 */
139
140void _CORE_semaphore_Flush(
141  CORE_semaphore_Control         *the_semaphore,
142  Thread_queue_Flush_callout      remote_extract_callout,
143  unsigned32                      status
144);
145
146/*
147 *  _CORE_semaphore_Get_count
148 *
149 *  DESCRIPTION:
150 *
151 *  This routine returns the current count associated with the semaphore.
152 */
153
154STATIC INLINE unsigned32 _CORE_semaphore_Get_count(
155  CORE_semaphore_Control  *the_semaphore
156);
157
158/*
159 *  _CORE_semaphore_Is_priority
160 *
161 *  DESCRIPTION:
162 *
163 *  This function returns TRUE if the priority attribute is
164 *  enabled in the attribute_set and FALSE otherwise.
165 */
166
167STATIC INLINE boolean _CORE_semaphore_Is_priority(
168  CORE_semaphore_Attributes *the_attribute
169);
170
171#include <rtems/core/coresem.inl>
172
173#ifdef __cplusplus
174}
175#endif
176 
177#endif
178/*  end of include file */
179
Note: See TracBrowser for help on using the repository browser.