Back to home page

LXR

 
 

    


Warning, /cpukit/include/adainclude/rtems-tasks.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-2008.
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.Tasks is
0041 
0042    --
0043    --  Task Manager
0044    --
0045 
0046    procedure Create
0047      (Name             : in RTEMS.Name;
0048       Initial_Priority : in Priority;
0049       Stack_Size       : in RTEMS.Size;
0050       Initial_Modes    : in RTEMS.Mode;
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          Initial_Priority : Priority;
0058          Stack_Size       : RTEMS.Size;
0059          Initial_Modes    : RTEMS.Mode;
0060          Attribute_Set    : RTEMS.Attribute;
0061          ID               : access RTEMS.ID)
0062          return             RTEMS.Status_Codes;
0063       pragma Import (C, Create_Base, "rtems_task_create");
0064       ID_Base : aliased RTEMS.ID;
0065    begin
0066       Result :=
0067          Create_Base
0068            (Name,
0069             Initial_Priority,
0070             Stack_Size,
0071             Initial_Modes,
0072             Attribute_Set,
0073             ID_Base'Access);
0074       ID     := ID_Base;
0075    end Create;
0076 
0077    procedure Ident
0078      (Name   : in RTEMS.Name;
0079       Node   : in RTEMS.Node;
0080       ID     : out RTEMS.ID;
0081       Result : out RTEMS.Status_Codes)
0082    is
0083 
0084       function Ident_Base
0085         (Name : RTEMS.Name;
0086          Node : RTEMS.Node;
0087          ID   : access RTEMS.ID)
0088          return RTEMS.Status_Codes;
0089       pragma Import (C, Ident_Base, "rtems_task_ident");
0090       ID_Base : aliased RTEMS.ID;
0091 
0092    begin
0093 
0094       Result := Ident_Base (Name, Node, ID_Base'Access);
0095       ID     := ID_Base;
0096 
0097    end Ident;
0098 
0099    procedure Start
0100      (ID          : in RTEMS.ID;
0101       Entry_Point : in RTEMS.Tasks.Entry_Point;
0102       Argument    : in RTEMS.Tasks.Argument;
0103       Result      : out RTEMS.Status_Codes)
0104    is
0105       function Start_Base
0106         (ID          : RTEMS.ID;
0107          Entry_Point : RTEMS.Tasks.Entry_Point;
0108          Argument    : RTEMS.Tasks.Argument)
0109          return        RTEMS.Status_Codes;
0110       pragma Import (C, Start_Base, "rtems_task_start");
0111    begin
0112 
0113       Result := Start_Base (ID, Entry_Point, Argument);
0114 
0115    end Start;
0116 
0117    procedure Restart
0118      (ID       : in RTEMS.ID;
0119       Argument : in RTEMS.Tasks.Argument;
0120       Result   : out RTEMS.Status_Codes)
0121    is
0122       function Restart_Base
0123         (ID       : RTEMS.ID;
0124          Argument : RTEMS.Tasks.Argument)
0125          return     RTEMS.Status_Codes;
0126       pragma Import (C, Restart_Base, "rtems_task_restart");
0127    begin
0128 
0129       Result := Restart_Base (ID, Argument);
0130 
0131    end Restart;
0132 
0133    procedure Delete
0134      (ID     : in RTEMS.ID;
0135       Result : out RTEMS.Status_Codes)
0136    is
0137       function Delete_Base (ID : RTEMS.ID) return RTEMS.Status_Codes;
0138       pragma Import (C, Delete_Base, "rtems_task_delete");
0139    begin
0140 
0141       Result := Delete_Base (ID);
0142 
0143    end Delete;
0144 
0145    procedure Suspend
0146      (ID     : in RTEMS.ID;
0147       Result : out RTEMS.Status_Codes)
0148    is
0149       function Suspend_Base (ID : RTEMS.ID) return RTEMS.Status_Codes;
0150       pragma Import (C, Suspend_Base, "rtems_task_suspend");
0151    begin
0152 
0153       Result := Suspend_Base (ID);
0154 
0155    end Suspend;
0156 
0157    procedure Resume
0158      (ID     : in RTEMS.ID;
0159       Result : out RTEMS.Status_Codes)
0160    is
0161       function Resume_Base (ID : RTEMS.ID) return RTEMS.Status_Codes;
0162       pragma Import (C, Resume_Base, "rtems_task_resume");
0163    begin
0164 
0165       Result := Resume_Base (ID);
0166 
0167    end Resume;
0168 
0169    procedure Is_Suspended
0170      (ID     : in RTEMS.ID;
0171       Result : out RTEMS.Status_Codes)
0172    is
0173       function Is_Suspended_Base
0174         (ID   : RTEMS.ID)
0175          return RTEMS.Status_Codes;
0176       pragma Import (C, Is_Suspended_Base, "rtems_task_is_suspended");
0177    begin
0178 
0179       Result := Is_Suspended_Base (ID);
0180 
0181    end Is_Suspended;
0182 
0183    procedure Set_Priority
0184      (ID           : in RTEMS.ID;
0185       New_Priority : in Priority;
0186       Old_Priority : out Priority;
0187       Result       : out RTEMS.Status_Codes)
0188    is
0189       function Set_Priority_Base
0190         (ID           : RTEMS.ID;
0191          New_Priority : Priority;
0192          Old_Priority : access Priority)
0193          return         RTEMS.Status_Codes;
0194       pragma Import (C, Set_Priority_Base, "rtems_task_set_priority");
0195       Old_Priority_Base : aliased Priority;
0196    begin
0197 
0198       Result       :=
0199          Set_Priority_Base (ID, New_Priority, Old_Priority_Base'Access);
0200       Old_Priority := Old_Priority_Base;
0201 
0202    end Set_Priority;
0203 
0204    procedure Mode
0205      (Mode_Set          : in RTEMS.Mode;
0206       Mask              : in RTEMS.Mode;
0207       Previous_Mode_Set : out RTEMS.Mode;
0208       Result            : out RTEMS.Status_Codes)
0209    is
0210       function Mode_Base
0211         (Mode_Set          : RTEMS.Mode;
0212          Mask              : RTEMS.Mode;
0213          Previous_Mode_Set : access RTEMS.Mode)
0214          return              RTEMS.Status_Codes;
0215       pragma Import (C, Mode_Base, "rtems_task_mode");
0216       Previous_Mode_Set_Base : aliased RTEMS.Mode;
0217    begin
0218 
0219       Result            :=
0220          Mode_Base (Mode_Set, Mask, Previous_Mode_Set_Base'Access);
0221       Previous_Mode_Set := Previous_Mode_Set_Base;
0222 
0223    end Mode;
0224 
0225    procedure Wake_When
0226      (Time_Buffer : in RTEMS.Time_Of_Day;
0227       Result      : out RTEMS.Status_Codes)
0228    is
0229       function Wake_When_Base
0230         (Time_Buffer : RTEMS.Time_Of_Day)
0231          return        RTEMS.Status_Codes;
0232       pragma Import (C, Wake_When_Base, "rtems_task_wake_when");
0233    begin
0234 
0235       Result := Wake_When_Base (Time_Buffer);
0236 
0237    end Wake_When;
0238 
0239    procedure Wake_After
0240      (Ticks  : in RTEMS.Interval;
0241       Result : out RTEMS.Status_Codes)
0242    is
0243       function Wake_After_Base
0244         (Ticks : RTEMS.Interval)
0245          return  RTEMS.Status_Codes;
0246       pragma Import (C, Wake_After_Base, "rtems_task_wake_after");
0247    begin
0248 
0249       Result := Wake_After_Base (Ticks);
0250 
0251    end Wake_After;
0252 
0253 end RTEMS.Tasks;