File : s-taprop-raven-cert.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2016, AdaCore --
10 -- --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This is the Ravenscar Cert version of this package
33
34 -- This package contains all the GNULL primitives that interface directly
35 -- with the underlying OS.
36
37 with System.Parameters;
38 -- used for Size_Type
39
40 with System.Tasking;
41 -- in spec:
42 -- used for Task_Id
43 -- in body:
44 -- used for Ada_Task_Control_Block
45 -- Task_Id
46 -- ATCB components and types
47
48 with System.Multiprocessors;
49 -- used for CPU_Range
50
51 package System.Task_Primitives.Operations is
52 pragma Preelaborate;
53
54 package ST renames System.Tasking;
55
56 Environment_Task : ST.Task_Id := ST.Null_Task;
57 -- Task ID of the environment task
58
59 -- See s-taprop.ads for up to date specs of the following subprograms
60
61 procedure Initialize (Environment_Task : ST.Task_Id);
62 pragma Inline (Initialize);
63
64 procedure Create_Task
65 (T : ST.Task_Id;
66 Wrapper : System.Address;
67 Stack_Size : System.Parameters.Size_Type;
68 Priority : System.Any_Priority;
69 Base_CPU : System.Multiprocessors.CPU_Range;
70 Succeeded : out Boolean);
71 pragma Inline (Create_Task);
72
73 procedure Enter_Task (Self_ID : ST.Task_Id);
74 pragma Inline (Enter_Task);
75
76 procedure Initialize_TCB (Self_ID : ST.Task_Id; Succeeded : out Boolean);
77 pragma Inline (Initialize_TCB);
78
79 function Self return ST.Task_Id;
80 pragma Inline (Self);
81
82 procedure Set_Priority
83 (T : ST.Task_Id;
84 Prio : System.Any_Priority);
85 pragma Inline (Set_Priority);
86
87 function Get_Priority (T : ST.Task_Id) return System.Any_Priority;
88 pragma Inline (Get_Priority);
89
90 subtype Time is Duration;
91 -- Match the size and representation of Duration
92
93 function Monotonic_Clock return Time;
94 pragma Inline (Monotonic_Clock);
95
96 function RT_Resolution return Time;
97 -- Return the number of ticks per second
98 pragma Inline (RT_Resolution);
99
100 ----------------
101 -- Extensions --
102 ----------------
103
104 procedure Sleep
105 (Self_ID : ST.Task_Id;
106 Reason : System.Tasking.Task_States);
107 pragma Inline (Sleep);
108 -- The caller should hold no lock when calling this procedure
109
110 procedure Delay_Until (Abs_Time : Time);
111 pragma Inline (Delay_Until);
112
113 procedure Wakeup
114 (T : ST.Task_Id;
115 Reason : System.Tasking.Task_States);
116 pragma Inline (Wakeup);
117 -- The caller should hold no lock when calling this procedure
118
119 function Is_Task_Context return Boolean;
120 pragma Inline (Is_Task_Context);
121 -- This function returns True if the current execution is in the context
122 -- of a task, and False if it is an interrupt context.
123
124 end System.Task_Primitives.Operations;