Warning, /cpukit/include/adainclude/rtems-semaphore.adb is written in an unsupported language. File is not indexed.
0001 -- SPDX-License-Identifier: BSD-2-Clause
0002
0003 --
0004 -- RTEMS / Body
0005 --
0006 -- DESCRIPTION:
0007 --
0008 -- This package provides the interface to the RTEMS API.
0009 --
0010 --
0011 -- DEPENDENCIES:
0012 --
0013 --
0014 --
0015 -- COPYRIGHT (c) 1997-2011.
0016 -- On-Line Applications Research Corporation (OAR).
0017 --
0018 -- Redistribution and use in source and binary forms, with or without
0019 -- modification, are permitted provided that the following conditions
0020 -- are met:
0021 -- 1. Redistributions of source code must retain the above copyright
0022 -- notice, this list of conditions and the following disclaimer.
0023 -- 2. Redistributions in binary form must reproduce the above copyright
0024 -- notice, this list of conditions and the following disclaimer in the
0025 -- documentation and/or other materials provided with the distribution.
0026 --
0027 -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0028 -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0029 -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0030 -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0031 -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0032 -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0033 -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0034 -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0035 -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0036 -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0037 -- POSSIBILITY OF SUCH DAMAGE.
0038 --
0039
0040 package body RTEMS.Semaphore is
0041
0042 --
0043 -- Semaphore Manager
0044 --
0045
0046 procedure Create
0047 (Name : in RTEMS.Name;
0048 Count : in RTEMS.Unsigned32;
0049 Attribute_Set : in RTEMS.Attribute;
0050 Priority_Ceiling : in RTEMS.Tasks.Priority;
0051 ID : out RTEMS.ID;
0052 Result : out RTEMS.Status_Codes)
0053 is
0054 function Create_Base
0055 (Name : RTEMS.Name;
0056 Count : RTEMS.Unsigned32;
0057 Attribute_Set : RTEMS.Attribute;
0058 Priority_Ceiling : RTEMS.Tasks.Priority;
0059 ID : access RTEMS.ID)
0060 return RTEMS.Status_Codes;
0061 pragma Import (C, Create_Base, "rtems_semaphore_create");
0062 ID_Base : aliased RTEMS.ID;
0063 begin
0064
0065 Result :=
0066 Create_Base
0067 (Name,
0068 Count,
0069 Attribute_Set,
0070 Priority_Ceiling,
0071 ID_Base'Access);
0072 ID := ID_Base;
0073
0074 end Create;
0075
0076 procedure Delete
0077 (ID : in RTEMS.ID;
0078 Result : out RTEMS.Status_Codes)
0079 is
0080 function Delete_Base
0081 (ID : RTEMS.ID)
0082 return RTEMS.Status_Codes;
0083 pragma Import (C, Delete_Base, "rtems_semaphore_delete");
0084 begin
0085
0086 Result := Delete_Base (ID);
0087
0088 end Delete;
0089
0090 procedure Ident
0091 (Name : in RTEMS.Name;
0092 Node : in RTEMS.Unsigned32;
0093 ID : out RTEMS.ID;
0094 Result : out RTEMS.Status_Codes)
0095 is
0096 function Ident_Base
0097 (Name : RTEMS.Name;
0098 Node : RTEMS.Unsigned32;
0099 ID : access RTEMS.ID)
0100 return RTEMS.Status_Codes;
0101 pragma Import (C, Ident_Base, "rtems_semaphore_ident");
0102 ID_Base : aliased RTEMS.ID;
0103 begin
0104
0105 Result := Ident_Base (Name, Node, ID_Base'Access);
0106 ID := ID_Base;
0107
0108 end Ident;
0109
0110 procedure Obtain
0111 (ID : in RTEMS.ID;
0112 Option_Set : in RTEMS.Option;
0113 Timeout : in RTEMS.Interval;
0114 Result : out RTEMS.Status_Codes)
0115 is
0116 function Obtain_Base
0117 (ID : RTEMS.ID;
0118 Option_Set : RTEMS.Option;
0119 Timeout : RTEMS.Interval)
0120 return RTEMS.Status_Codes;
0121 pragma Import (C, Obtain_Base, "rtems_semaphore_obtain");
0122 begin
0123
0124 Result := Obtain_Base (ID, Option_Set, Timeout);
0125
0126 end Obtain;
0127
0128 procedure Release
0129 (ID : in RTEMS.ID;
0130 Result : out RTEMS.Status_Codes)
0131 is
0132 function Release_Base
0133 (ID : RTEMS.ID)
0134 return RTEMS.Status_Codes;
0135 pragma Import (C, Release_Base, "rtems_semaphore_release");
0136 begin
0137
0138 Result := Release_Base (ID);
0139
0140 end Release;
0141
0142 procedure Flush
0143 (ID : in RTEMS.ID;
0144 Result : out RTEMS.Status_Codes)
0145 is
0146 function Flush_Base
0147 (ID : RTEMS.ID)
0148 return RTEMS.Status_Codes;
0149 pragma Import (C, Flush_Base, "rtems_semaphore_flush");
0150 begin
0151
0152 Result := Flush_Base (ID);
0153
0154 end Flush;
0155
0156 end RTEMS.Semaphore;