Back to home page

LXR

 
 

    


Warning, /cpukit/include/adainclude/rtems-region.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.Region is
0041 
0042    --
0043    -- Region Manager
0044    --
0045 
0046    procedure Create
0047      (Name             : in RTEMS.Name;
0048       Starting_Address : in RTEMS.Address;
0049       Length           : in RTEMS.Size;
0050       Page_Size        : in RTEMS.Size;
0051       Attribute_Set    : in RTEMS.Attribute;
0052       ID               : out RTEMS.ID;
0053       Result           : out RTEMS.Status_Codes)
0054    is
0055       function Create_Base
0056         (Name             : RTEMS.Name;
0057          Starting_Address : RTEMS.Address;
0058          Length           : RTEMS.Size;
0059          Page_Size        : RTEMS.Size;
0060          Attribute_Set    : RTEMS.Attribute;
0061          ID               : access RTEMS.ID)
0062          return             RTEMS.Status_Codes;
0063       pragma Import (C, Create_Base, "rtems_region_create");
0064       ID_Base : aliased RTEMS.ID;
0065    begin
0066 
0067       Result :=
0068          Create_Base
0069            (Name,
0070             Starting_Address,
0071             Length,
0072             Page_Size,
0073             Attribute_Set,
0074             ID_Base'Access);
0075       ID     := ID_Base;
0076 
0077    end Create;
0078 
0079    procedure Ident
0080      (Name   : in RTEMS.Name;
0081       ID     : out RTEMS.ID;
0082       Result : out RTEMS.Status_Codes)
0083    is
0084       function Ident_Base
0085         (Name : RTEMS.Name;
0086          ID   : access RTEMS.ID)
0087          return RTEMS.Status_Codes;
0088       pragma Import (C, Ident_Base, "rtems_region_ident");
0089       ID_Base : aliased RTEMS.ID;
0090    begin
0091 
0092       Result := Ident_Base (Name, ID_Base'Access);
0093       ID     := ID_Base;
0094 
0095    end Ident;
0096 
0097    procedure Delete
0098      (ID     : in RTEMS.ID;
0099       Result : out RTEMS.Status_Codes)
0100    is
0101       function Delete_Base (ID : RTEMS.ID) return RTEMS.Status_Codes;
0102       pragma Import (C, Delete_Base, "rtems_region_delete");
0103    begin
0104 
0105       Result := Delete_Base (ID);
0106 
0107    end Delete;
0108 
0109    procedure Extend
0110      (ID               : in RTEMS.ID;
0111       Starting_Address : in RTEMS.Address;
0112       Length           : in RTEMS.Size;
0113       Result           : out RTEMS.Status_Codes)
0114    is
0115       function Extend_Base
0116         (ID               : RTEMS.ID;
0117          Starting_Address : RTEMS.Address;
0118          Length           : RTEMS.Size)
0119          return             RTEMS.Status_Codes;
0120       pragma Import (C, Extend_Base, "rtems_region_extend");
0121    begin
0122 
0123       Result := Extend_Base (ID, Starting_Address, Length);
0124 
0125    end Extend;
0126 
0127    procedure Get_Segment
0128      (ID         : in RTEMS.ID;
0129       Size       : in RTEMS.Size;
0130       Option_Set : in RTEMS.Option;
0131       Timeout    : in RTEMS.Interval;
0132       Segment    : out RTEMS.Address;
0133       Result     : out RTEMS.Status_Codes)
0134    is
0135       function Get_Segment_Base
0136         (ID         : RTEMS.ID;
0137          Size       : RTEMS.Size;
0138          Option_Set : RTEMS.Option;
0139          Timeout    : RTEMS.Interval;
0140          Segment    : access RTEMS.Address)
0141          return       RTEMS.Status_Codes;
0142       pragma Import (C, Get_Segment_Base, "rtems_region_get_segment");
0143       Segment_Base : aliased RTEMS.Address;
0144    begin
0145 
0146       Result  :=
0147          Get_Segment_Base
0148            (ID,
0149             Size,
0150             Option_Set,
0151             Timeout,
0152             Segment_Base'Access);
0153       Segment := Segment_Base;
0154 
0155    end Get_Segment;
0156 
0157    procedure Get_Segment_Size
0158      (ID      : in RTEMS.ID;
0159       Segment : in RTEMS.Address;
0160       Size    : out RTEMS.Size;
0161       Result  : out RTEMS.Status_Codes)
0162    is
0163       function Get_Segment_Size_Base
0164         (ID      : RTEMS.ID;
0165          Segment : RTEMS.Address;
0166          Size    : access RTEMS.Size)
0167          return    RTEMS.Status_Codes;
0168       pragma Import
0169         (C,
0170          Get_Segment_Size_Base,
0171          "rtems_region_get_segment_size");
0172       Size_Base : aliased RTEMS.Size;
0173    begin
0174 
0175       Result := Get_Segment_Size_Base (ID, Segment, Size_Base'Access);
0176       Size   := Size_Base;
0177 
0178    end Get_Segment_Size;
0179 
0180    procedure Return_Segment
0181      (ID      : in RTEMS.ID;
0182       Segment : in RTEMS.Address;
0183       Result  : out RTEMS.Status_Codes)
0184    is
0185       function Return_Segment_Base
0186         (ID      : RTEMS.ID;
0187          Segment : RTEMS.Address)
0188          return    RTEMS.Status_Codes;
0189       pragma Import
0190         (C,
0191          Return_Segment_Base,
0192          "rtems_region_return_segment");
0193    begin
0194 
0195       Result := Return_Segment_Base (ID, Segment);
0196 
0197    end Return_Segment;
0198 
0199    procedure Resize_Segment
0200      (ID       : in RTEMS.ID;
0201       Segment  : in RTEMS.Address;
0202       Size     : in RTEMS.Size;
0203       Old_Size : out RTEMS.Size;
0204       Result   : out RTEMS.Status_Codes)
0205    is
0206       function Resize_Segment_Base
0207         (ID       : RTEMS.ID;
0208          Segment  : RTEMS.Address;
0209          Size     : RTEMS.Size;
0210          Old_Size : access RTEMS.Size)
0211          return     RTEMS.Status_Codes;
0212       pragma Import
0213         (C,
0214          Resize_Segment_Base,
0215          "rtems_region_resize_segment");
0216       Old_Size_Base : aliased RTEMS.Size;
0217    begin
0218 
0219       Result   :=
0220          Resize_Segment_Base (ID, Segment, Size, Old_Size_Base'Access);
0221       Old_Size := Old_Size_Base;
0222 
0223    end Resize_Segment;
0224 
0225 end RTEMS.Region;