POK
apex-processes.ads
1 -- ---------------------------------------------------------------------------
2 -- --
3 -- PROCESS constant and type definitions and management services --
4 -- --
5 -- ---------------------------------------------------------------------------
6 package APEX.Processes is
7  Max_Number_Of_Processes : constant := System_Limit_Number_Of_Processes;
8  Min_Priority_Value : constant := 0;
9  Max_Priority_Value : constant := 249;
10  Max_Lock_Level : constant := 32;
11  subtype Process_Name_Type is Name_Type;
12  type Process_Id_Type is private;
13  Null_Process_Id : constant Process_Id_Type;
14  subtype Lock_Level_Type is APEX_Integer range 0 .. Max_Lock_Level;
15  subtype Stack_Size_Type is APEX_Unsigned;
16  subtype Waiting_Range_Type is APEX_Integer range
17  0 .. Max_Number_Of_Processes;
18  subtype Priority_Type is APEX_Integer range
19  Min_Priority_Value .. Max_Priority_Value;
20  type Process_State_Type is (Dormant, Ready, Running, Waiting);
21  type Deadline_Type is (Soft, Hard);
22  type Process_Attribute_Type is record
23  Period : System_Time_Type;
24  Time_Capacity : System_Time_Type;
25  Entry_Point : System_Address_Type;
26  Stack_Size : Stack_Size_Type;
27  Base_Priority : Priority_Type;
28  Deadline : Deadline_Type;
29  Name : Process_Name_Type;
30  end record;
31  type Process_Status_Type is record
32  Deadline_Time : System_Time_Type;
33  Current_Priority : Priority_Type;
34  Process_State : Process_State_Type;
35  Attributes : Process_Attribute_Type;
36  end record;
37  procedure Create_Process
38  (Attributes : in Process_Attribute_Type;
39  Process_Id : out Process_Id_Type;
40  Return_Code : out Return_Code_Type);
41  procedure Set_Priority
42  (Process_Id : in Process_Id_Type;
43  Priority : in Priority_Type;
44  Return_Code : out Return_Code_Type);
45  procedure Suspend_Self
46  (Time_Out : in System_Time_Type;
47  Return_Code : out Return_Code_Type);
48  procedure Suspend
49  (Process_Id : in Process_Id_Type;
50  Return_Code : out Return_Code_Type);
51  procedure Resume
52  (Process_Id : in Process_Id_Type;
53  Return_Code : out Return_Code_Type);
54  procedure Stop_Self;
55  procedure Stop
56  (Process_Id : in Process_Id_Type;
57  Return_Code : out Return_Code_Type);
58  procedure Start
59  (Process_Id : in Process_Id_Type;
60  Return_Code : out Return_Code_Type);
61  procedure Delayed_Start
62  (Process_Id : in Process_Id_Type;
63  Delay_Time : in System_Time_Type;
64  Return_Code : out Return_Code_Type);
65  procedure Lock_Preemption
66  (Lock_Level : out Lock_Level_Type;
67  Return_Code : out Return_Code_Type);
68  procedure Unlock_Preemption
69  (Lock_Level : out Lock_Level_Type;
70  Return_Code : out Return_Code_Type);
71  procedure Get_My_Id
72  (Process_Id : out Process_Id_Type;
73  Return_Code : out Return_Code_Type);
74  procedure Get_Process_Id
75  (Process_Name : in Process_Name_Type;
76  Process_Id : out Process_Id_Type;
77  Return_Code : out Return_Code_Type);
78  procedure Get_Process_Status
79  (Process_Id : in Process_Id_Type;
80  Process_Status : out Process_Status_Type;
81  Return_Code : out Return_Code_Type);
82 private
83  type Process_ID_Type is new APEX_Integer;
84  Null_Process_Id : constant Process_Id_Type := 0;
85  pragma Convention (C, Process_State_Type);
86  pragma Convention (C, Deadline_Type);
87  pragma Convention (C, Process_Attribute_Type);
88  pragma Convention (C, Process_Status_Type);
89 
90  -- POK BINDINGS
91  pragma Import (C, Create_Process, "CREATE_PROCESS");
92  pragma Import (C, Set_Priority, "SET_PRIORITY");
93  pragma Import (C, Suspend_Self, "SUSPEND_SELF");
94  pragma Import (C, Suspend, "SUSPEND");
95  pragma Import (C, Resume, "SUSPEND");
96  pragma Import (C, Stop_Self, "STOP_SELF");
97  pragma Import (C, Stop, "STOP");
98  pragma Import (C, Start, "START");
99  pragma Import (C, Delayed_Start, "DELAYED_START");
100  pragma Import (C, Lock_Preemption, "LOCK_PREEMPTION");
101  pragma Import (C, Unlock_Preemption, "UNLOCK_PREEMPTION");
102  pragma Import (C, Get_My_Id, "GET_MY_ID");
103  pragma Import (C, Get_Process_Id, "GET_PROCESS_ID");
104  pragma Import (C, Get_Process_Status, "GET_PROCESS_STATUS");
105  -- END OF POK BINDINGS
106 end APEX.Processes;