POK
/home/jaouen/pok_official/pok/trunk/libpok/ada/arinc653/apex-processes.ads
00001 -- ---------------------------------------------------------------------------
00002 -- --
00003 -- PROCESS constant and type definitions and management services --
00004 -- --
00005 -- ---------------------------------------------------------------------------
00006 package APEX.Processes is
00007    Max_Number_Of_Processes : constant := System_Limit_Number_Of_Processes;
00008    Min_Priority_Value : constant := 0;
00009    Max_Priority_Value : constant := 249;
00010    Max_Lock_Level : constant := 32;
00011    subtype Process_Name_Type is Name_Type;
00012    type Process_Id_Type is private;
00013    Null_Process_Id : constant Process_Id_Type;
00014    subtype Lock_Level_Type is APEX_Integer range 0 .. Max_Lock_Level;
00015    subtype Stack_Size_Type is APEX_Unsigned;
00016    subtype Waiting_Range_Type is APEX_Integer range
00017       0 .. Max_Number_Of_Processes;
00018    subtype Priority_Type is APEX_Integer range
00019       Min_Priority_Value .. Max_Priority_Value;
00020    type Process_State_Type is (Dormant, Ready, Running, Waiting);
00021    type Deadline_Type is (Soft, Hard);
00022    type Process_Attribute_Type is record
00023        Period        : System_Time_Type;
00024        Time_Capacity : System_Time_Type;
00025        Entry_Point   : System_Address_Type;
00026        Stack_Size    : Stack_Size_Type;
00027        Base_Priority : Priority_Type;
00028        Deadline      : Deadline_Type;
00029        Name          : Process_Name_Type;
00030    end record;
00031    type Process_Status_Type is record
00032        Deadline_Time    : System_Time_Type;
00033        Current_Priority : Priority_Type;
00034        Process_State    : Process_State_Type;
00035        Attributes       : Process_Attribute_Type;
00036    end record;
00037    procedure Create_Process
00038       (Attributes : in Process_Attribute_Type;
00039        Process_Id : out Process_Id_Type;
00040        Return_Code : out Return_Code_Type);
00041    procedure Set_Priority
00042       (Process_Id : in Process_Id_Type;
00043        Priority    : in Priority_Type;
00044        Return_Code : out Return_Code_Type);
00045    procedure Suspend_Self
00046       (Time_Out    : in System_Time_Type;
00047        Return_Code : out Return_Code_Type);
00048    procedure Suspend
00049       (Process_Id : in Process_Id_Type;
00050        Return_Code : out Return_Code_Type);
00051    procedure Resume
00052       (Process_Id : in Process_Id_Type;
00053        Return_Code : out Return_Code_Type);
00054    procedure Stop_Self;
00055    procedure Stop
00056       (Process_Id : in Process_Id_Type;
00057       Return_Code : out Return_Code_Type);
00058    procedure Start
00059      (Process_Id : in Process_Id_Type;
00060       Return_Code : out Return_Code_Type);
00061    procedure Delayed_Start
00062      (Process_Id : in Process_Id_Type;
00063       Delay_Time : in System_Time_Type;
00064       Return_Code : out Return_Code_Type);
00065    procedure Lock_Preemption
00066      (Lock_Level : out Lock_Level_Type;
00067       Return_Code : out Return_Code_Type);
00068    procedure Unlock_Preemption
00069      (Lock_Level : out Lock_Level_Type;
00070       Return_Code : out Return_Code_Type);
00071    procedure Get_My_Id
00072      (Process_Id : out Process_Id_Type;
00073       Return_Code : out Return_Code_Type);
00074    procedure Get_Process_Id
00075      (Process_Name : in Process_Name_Type;
00076       Process_Id    : out Process_Id_Type;
00077       Return_Code : out Return_Code_Type);
00078    procedure Get_Process_Status
00079      (Process_Id      : in Process_Id_Type;
00080       Process_Status : out Process_Status_Type;
00081       Return_Code     : out Return_Code_Type);
00082 private
00083    type Process_ID_Type is new APEX_Integer;
00084    Null_Process_Id : constant Process_Id_Type := 0;
00085    pragma Convention (C, Process_State_Type);
00086    pragma Convention (C, Deadline_Type);
00087    pragma Convention (C, Process_Attribute_Type);
00088    pragma Convention (C, Process_Status_Type);
00089 
00090    -- POK BINDINGS
00091    pragma Import (C, Create_Process, "CREATE_PROCESS");
00092    pragma Import (C, Set_Priority, "SET_PRIORITY");
00093    pragma Import (C, Suspend_Self, "SUSPEND_SELF");
00094    pragma Import (C, Suspend, "SUSPEND");
00095    pragma Import (C, Resume, "SUSPEND");
00096    pragma Import (C, Stop_Self, "STOP_SELF");
00097    pragma Import (C, Stop, "STOP");
00098    pragma Import (C, Start, "START");
00099    pragma Import (C, Delayed_Start, "DELAYED_START");
00100    pragma Import (C, Lock_Preemption, "LOCK_PREEMPTION");
00101    pragma Import (C, Unlock_Preemption, "UNLOCK_PREEMPTION");
00102    pragma Import (C, Get_My_Id, "GET_MY_ID");
00103    pragma Import (C, Get_Process_Id, "GET_PROCESS_ID");
00104    pragma Import (C, Get_Process_Status, "GET_PROCESS_STATUS");
00105    -- END OF POK BINDINGS
00106 end APEX.Processes;