------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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: 534 $ -- $Date: 2012-10-05 19:46:28 +0200 (Fri, 05 Oct 2012) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; with Framework_Config; use Framework_Config; with Scheduler; use Scheduler; with Scheduler_Interface; use Scheduler_Interface; with Processors; use Processors; with Processors.extended; use Processors.extended; with processor_interface; use processor_interface; with sets; with Ada.Numerics.Aux; use Ada.Numerics.Aux; package Processor_Set is ---------------------------------------------------------- -- Definition of a set ---------------------------------------------------------- package Generic_Processor_Set is new Sets ( Max_Element => Framework_Config.Max_Processors, Element => Generic_Processor_Ptr, Free => Free, Copy => Copy, Put => Put, xml_string => XML_String, xml_ref_string => XML_ref_String); use Generic_Processor_Set; type Processors_Set is new Generic_Processor_Set.set with private; subtype Processors_Range is Generic_Processor_Set.element_range; subtype Processors_Iterator is Generic_Processor_Set.iterator; package Generic_core_unit_Set is new Sets ( Max_Element => Framework_Config.Max_Core_Units, Element => Core_Unit_Ptr, Free => Free, Copy => Copy, Put => Put, xml_string => XML_String, xml_ref_string => XML_ref_String); use Generic_core_unit_Set; type core_units_Set is new Generic_core_unit_Set.set with private; subtype core_units_Range is Generic_core_unit_Set.element_range; subtype core_units_Iterator is Generic_core_unit_Set.iterator; ---------------------------------------------------------- -- Exceptions defined in the set package ---------------------------------------------------------- -- Raised when a given processor/core unit is not in a processor/core unit --set -- Processor_Not_Found : exception; core_unit_Not_Found : exception; -- Raised when parameters provided to Add_processor are wrong -- Invalid_Parameter : exception; -- Raised when the scheduler code of a parametric scheduler -- does not have a right syntax -- Scheduler_Syntax_Error : exception; ---------------------------------------------------------- -- I/O operations ---------------------------------------------------------- function Export_Aadl_Implementations (My_Processors : in Processors_Set) return Unbounded_String; function Export_Aadl_Declarations (My_Processors : in Processors_Set; Number_Of_Ht : in Natural) return Unbounded_String; function Export_Xml (My_Processors : in Processors_Set) return Unbounded_String; ---------------------------------------------------------- -- Procedure to proceed modification on a set ---------------------------------------------------------- procedure Check_core_unit (Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Double; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; automaton_name : in Unbounded_String := empty_string); procedure set_processor_scheduler (A_core_unit : in Core_Unit_Ptr; processor_name : in Unbounded_String); procedure set_core_unit_scheduler (A_core_unit : in extended_Core_Unit_Ptr; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Double; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; automaton_name : in Unbounded_String := empty_string); procedure Add_core_unit (My_core_units : in out core_units_Set; A_core_unit : in out Core_Unit_Ptr; Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Double; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; automaton_name : in Unbounded_String := empty_string); procedure Add_core_unit (My_core_units : in out core_units_Set; Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Double; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; automaton_name : in Unbounded_String := empty_string); -------------------------------------------- -- Create a monocore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; A_Processor : in out Generic_Processor_Ptr; Name : in Unbounded_String; A_Network : in Unbounded_String; a_Core : in Core_Unit_Ptr); -- Create a monocore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; Name : in Unbounded_String; A_Network : in Unbounded_String; a_Core : in Core_Unit_Ptr); -- Create a multicore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; A_Processor : in out Generic_Processor_Ptr; Name : in Unbounded_String; A_Network : in Unbounded_String; Cores : in Core_Units_Table; a_migration : migrations_type := job_level_migration_type; a_processor_type : processors_type := identical_multicores_type); -- Create a multicore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; Name : in Unbounded_String; A_Network : in Unbounded_String; Cores : in Core_Units_Table; a_migration : migrations_type := job_level_migration_type; a_processor_type : processors_type := identical_multicores_type); -- rebuild a table of core units for any processor type (both monocore or --multicore) -- function build_core_table (a_processor : Generic_Processor_Ptr) return Core_Units_Table; ------------------------------------------------------ -- Read information from a set ------------------------------------------------------ -- Get the processor pointer of the processor named "Name" -- function Search_Processor (My_Processors : in Processors_Set; Name : in Unbounded_String) return Generic_Processor_Ptr; -- Get the core unit pointer of the core unit named "Name" -- function Search_core_unit (My_core_units : in core_units_Set; Name : in Unbounded_String) return Core_Unit_Ptr; -- Get the core unit pointer of the core unit with a given id -- function Search_core_unit_by_id (My_core_units : in core_units_Set; id : in Unbounded_String) return Core_Unit_Ptr; ---------------------------------------------------------- -- List of parameters the user can set of get directly -- throught the set ---------------------------------------------------------- type Processor_Parameters is (Scheduler); function Get (My_Processors : in Processors_Set; Processor_Name : in Unbounded_String; Param_Name : in Processor_Parameters) return Generic_Scheduler_Ptr; procedure Set (My_Processors : in out Processors_Set; Processor_Name : in Unbounded_String; Param_Name : in Processor_Parameters; Param_Value : in Generic_Scheduler_Ptr); private type Processors_Set is new Generic_Processor_Set.set with null record; type core_units_Set is new Generic_core_unit_Set.set with null record; end Processor_Set;