------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real time scheduling analysis tool. -- This program provides services to automatically check performances -- of real time architectures. -- -- Copyright (C) 2002-2010, by Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- the LISyC Team, University of Western Britanny. -- -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- 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 : cheddar@listes.univ-brest.fr -- ----------------------------------------------------------------------------- -- Last update : -- $Rev: 422 $ -- $Date: 2011-04-20 20:59:09 +0200 (mer., 20 avr. 2011) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Xml_Tag; use Xml_Tag; with double_util; use double_util; with Translate; use Translate; with unbounded_strings; use unbounded_strings; with Text_IO; use Text_IO; with Ada.Exceptions; use Ada.Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; package body Scheduler.Fixed_Priority.aperiodic_server.deferrable is procedure Initialize (A_Scheduler : in out deferrable_aperiodic_server_Scheduler) is begin Reset (A_Scheduler); A_Scheduler.parameters.scheduler_type := hierarchical_deferrable_aperiodic_server_protocol; end Initialize; function Copy (A_Scheduler : in deferrable_aperiodic_server_Scheduler) return Generic_Scheduler_Ptr is Ptr : deferrable_aperiodic_server_Scheduler_Ptr; begin Ptr := new deferrable_aperiodic_server_Scheduler; Ptr.parameters := A_Scheduler.parameters; Ptr.Previously_Elected := A_Scheduler.Previously_Elected; Ptr.Used_Resource := A_Scheduler.Used_Resource; return Generic_Scheduler_Ptr (Ptr); end Copy; procedure Do_Election (My_Scheduler : in out deferrable_aperiodic_server_Scheduler; Si : in out Scheduling_Information; Result : in out Scheduling_Sequence_Ptr; Msg : in out Unbounded_String; Current_Time : in Natural; Processor_Name : in Unbounded_String; Address_Space_Name : in Unbounded_String; My_Dependencies : in Tasks_Dependencies_Ptr; With_Offsets : in Boolean; With_Precedencies : in Boolean; With_Resources : in Boolean; Event_To_Generate : in Time_Unit_Event_Type_Boolean_Table; Elected : in out Tasks_Range; No_Task : in out Boolean) is begin Do_Election (aperiodic_server_Scheduler (My_Scheduler), Si, Result, Msg, Current_Time, Processor_Name, Address_Space_Name, My_Dependencies, With_Offsets, With_Precedencies, With_Resources, Event_To_Generate, Elected, No_Task); -- Restart the aperiodic server release time and -- refill its capacity -- if My_Scheduler.current_server_wake_time = Current_Time then My_Scheduler.current_server_wake_time := My_Scheduler.current_server_wake_time + My_Scheduler.parameters.period; My_Scheduler.current_server_capacity := My_Scheduler.parameters.capacity; end if; -- Election : if there is a pending aperiodic task and -- the server's capacity is greater than 0 then -- the aperiodic task is serviced and the server's -- capacity decremented. -- Otherwise the periodic task is ran. -- No_Task := True; if (My_Scheduler.current_server_capacity > 0) and (My_Scheduler.aperiodic_Highest_Priority /= Natural'First) and (My_Scheduler.parameters.priority > Priority_Range (My_Scheduler.periodic_Highest_Priority)) then No_Task := False; Elected := My_Scheduler.aperiodic_Elected; My_Scheduler.current_server_capacity := My_Scheduler.current_server_capacity - 1; else if (My_Scheduler.periodic_Highest_Priority /= Natural'First) then No_Task := False; Elected := My_Scheduler.periodic_Elected; end if; end if; end Do_Election; end Scheduler.Fixed_Priority.aperiodic_server.deferrable;