------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This Ada package was automatically generated by the meta CASE tool Platypus -- see http://cassoulet.univ-brest.fr/mme -- -- Any modification of this file will be lost. -- Please see the "platypus" directory instead : it contains the Cheddar's -- model and its meta-model. ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a free real time scheduling tool. -- This program provides services to automatically check temporal constraints -- of real time tasks. -- -- Copyright (C) 2002-2009 Frank Singhoff -- Cheddar is developed by the LISYC Team, University of Brest -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- ---- Contact : F. Singhoff (singhoff@univ-brest.fr) -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ WITH Text_Io; USE Text_Io; WITH Parameters; USE Parameters; USE Parameters.User_Defined_Parameters_Table_Package; PACKAGE BODY Scheduler.User_Defined.Generated IS PROCEDURE Run_Priority_Section ( My_Scheduler : IN OUT Generated_User_Defined_Scheduler; Si : IN OUT Scheduling_Information; Current_Time : IN Natural; Processor_Name : IN Unbounded_String; My_Dependencies : IN Tasks_Dependencies_Ptr; Msg : IN OUT Unbounded_String) IS I : Tasks_Range; BEGIN -- if time_partition=0 -- then current_partition:=(current_partition+1) mod number_of_partition; -- time_partition:=partition_duration(current_partition); -- end if; IF My_Scheduler.Sc_Time_Partition=0 THEN My_Scheduler.Sc_Current_Partition:=( My_Scheduler.Sc_Current_Partition+1) mod My_Scheduler.Sc_Number_Of_Partition; My_Scheduler.Sc_Time_Partition:= My_Scheduler.Sc_Partition_Duration( Simulations_Range(My_Scheduler.Sc_Current_Partition)); END IF; -- for i in tasks_range loop -- if tasks.task_partition(i)=current_partition -- then dynamic_priority(i):=tasks.priority(i); -- else dynamic_priority(i):=0; -- end if; -- end loop; I:=0; LOOP IF (Si.Tcbs (I).Tsk.Cpu_Name = Processor_Name) THEN FOR J IN 0 .. Si.Tcbs (I).Tsk.Param.Nb_Entries - 1 LOOP IF To_Unbounded_String("tasks.task_partition") = To_Unbounded_String ("tasks.") & Si.Tcbs (I).Tsk.Param.Entries (J).Name THEN IF Integer (Si.Tcbs (I).Tsk.Param.Entries (J). Integer_Value) = My_Scheduler.Sc_Current_Partition THEN My_Scheduler.Sc_Dynamic_Priority(Simulations_Range(I)):= Integer ( Si.Tcbs (I).Tsk.priority); ELSE My_Scheduler.Sc_Dynamic_Priority(Simulations_Range(I)):= 0; END IF; END IF; END LOOP; END IF; I:=I+1; EXIT WHEN Si.Tcbs(I) = NULL; END LOOP; -- time_partition:=time_partition-1; My_Scheduler.Sc_Time_Partition:=My_Scheduler.Sc_Time_Partition-1; END Run_Priority_Section; PROCEDURE Run_Start_Section ( My_Scheduler : IN OUT Generated_User_Defined_Scheduler; Processor_Name : IN Unbounded_String; Msg : IN OUT Unbounded_String) IS BEGIN -- number_of_partition : integer :=2; My_Scheduler.Sc_Number_Of_Partition:=2; -- current_partition : integer :=0; My_Scheduler.Sc_Current_Partition:=0; -- time_partition : integer :=0; My_Scheduler.Sc_Time_Partition:=0; -- partition_duration(0):=2; My_Scheduler.Sc_Partition_Duration(0):=2; -- partition_duration(1):=4; My_Scheduler.Sc_Partition_Duration(1):=4; -- time_partition:=partition_duration(current_partition); My_Scheduler.Sc_Time_Partition:=My_Scheduler.Sc_Partition_Duration( Simulations_Range(My_Scheduler.Sc_Current_Partition)); -- dynamic_priority:=0; FOR I IN Integer_Table'RANGE LOOP My_Scheduler.Sc_Dynamic_Priority(I):=0; END LOOP; END Run_Start_Section; PROCEDURE Run_Election_Section ( My_Scheduler : IN OUT Generated_User_Defined_Scheduler; Si : IN OUT Scheduling_Information; Current_Time : IN Natural; Processor_Name : IN Unbounded_String; My_Dependencies : IN Tasks_Dependencies_Ptr; With_Offsets : IN Boolean; With_Precedencies : IN Boolean; With_Resources : IN Boolean; Elected : IN OUT Tasks_Range; No_Task : IN OUT Boolean) IS Highest : Natural := Natural'First; Found : Boolean := False; I : Tasks_Range := 0; BEGIN -- return max_to_index(dynamic_priority); LOOP IF (Si.Tcbs (I).Tsk.Cpu_Name = Processor_Name) THEN IF (Si.Tcbs (I).Wake_Up_Time <= Current_Time) AND (My_Scheduler.Sc_Dynamic_Priority(Simulations_Range(I)) > Highest) AND (Si.Tcbs (I).Rest_Of_Capacity /= 0) THEN IF (With_Offsets = False) OR Check_Offset (Si.Tcbs (I), Current_Time) THEN IF (With_Precedencies = False) OR Check_Precedencies (Si, My_Dependencies, Current_Time, Si.Tcbs (I)) THEN Highest :=My_Scheduler.Sc_Dynamic_Priority( Simulations_Range(I)); Elected := I; Found:=True; END IF; END IF; END IF; END IF; I := I + 1; EXIT WHEN Si.Tcbs (I) = NULL; END LOOP; IF NOT Found THEN No_Task := True; ELSE No_Task := False; END IF; END Run_Election_Section; END Scheduler.User_Defined.Generated ;