POK
/home/jaouen/pok_official/pok/trunk/libpok/ada/arinc653/apex-semaphores.ads
00001 -- ---------------------------------------------------------------------------
00002 -- --
00003 -- SEMAPHORE constant and type definitions and management services --
00004 -- --
00005 -- ---------------------------------------------------------------------------
00006 with APEX.Processes;
00007 package APEX.Semaphores is
00008    Max_Number_Of_Semaphores : constant := System_Limit_Number_Of_Semaphores;
00009    Max_Semaphore_Value : constant := 32_767;
00010    subtype Semaphore_Name_Type is Name_Type;
00011    type Semaphore_Id_Type is private;
00012    Null_Semaphore_Id : constant Semaphore_Id_Type;
00013    type Semaphore_Value_Type is new APEX_Integer range
00014        0 .. Max_Semaphore_Value;
00015    type Semaphore_Status_Type is record
00016        Current_Value      : Semaphore_Value_Type;
00017        Maximum_Value      : Semaphore_Value_Type;
00018        Waiting_Processes : APEX.Processes.Waiting_Range_Type;
00019    end record;
00020    procedure Create_Semaphore
00021       (Semaphore_Name      : in Semaphore_Name_Type;
00022        Current_Value       : in Semaphore_Value_Type;
00023        Maximum_Value       : in Semaphore_Value_Type;
00024        Queuing_Discipline : in Queuing_Discipline_Type;
00025        Semaphore_Id        : out Semaphore_Id_Type;
00026        Return_Code         : out Return_Code_Type);
00027    procedure Wait_Semaphore
00028       (Semaphore_Id : in Semaphore_Id_Type;
00029        Time_Out      : in System_Time_Type;
00030        Return_Code : out Return_Code_Type);
00031    procedure Signal_Semaphore
00032       (Semaphore_Id : in Semaphore_Id_Type;
00033        Return_Code : out Return_Code_Type);
00034    procedure Get_Semaphore_Id
00035       (Semaphore_Name : in Semaphore_Name_Type;
00036        Semaphore_Id    : out Semaphore_Id_Type;
00037        Return_Code     : out Return_Code_Type);
00038    procedure Get_Semaphore_Status
00039       (Semaphore_Id      : in Semaphore_Id_Type;
00040        Semaphore_Status : out Semaphore_Status_Type;
00041        Return_Code       : out Return_Code_Type);
00042 private
00043    type Semaphore_Id_Type is new APEX_Integer;
00044    Null_Semaphore_Id : constant Semaphore_Id_Type := 0;
00045    pragma Convention (C, Semaphore_Status_Type);
00046 
00047    -- POK BINDINGS
00048    pragma Import (C, Create_Semaphore, "CREATE_SEMAPHORE");
00049    pragma Import (C, Wait_Semaphore, "WAIT_SEMAPHORE");
00050    pragma Import (C, Signal_Semaphore, "SIGNAL_SEMAPHORE");
00051    pragma Import (C, Get_Semaphore_Id, "GET_SEMAPHORE_ID");
00052    pragma Import (C, Get_Semaphore_Status, "GET_SEMAPHORE_STATUS");
00053    -- END OF POK BINDINGS
00054 end APEX.Semaphores;