------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 Framework_Config; use Framework_Config; with Resources; use Resources; use Resources.Resource_accesses; with sets; package Resource_Set is ---------------------------------------------------------- -- Definition of a shared resource set ---------------------------------------------------------- package Generic_Resource_Set is new Sets ( Max_Element => Framework_Config.Max_Resources, Element => Generic_Resource_Ptr, Free => Free, Copy => Copy, Put => Put, xml_string => XML_String, xml_ref_string => XML_ref_String); use Generic_Resource_Set; type Resources_Set is new Generic_Resource_Set.set with private; subtype Resources_Range is Generic_Resource_Set.element_range; subtype Resources_Iterator is Generic_Resource_Set.iterator; ---------------------------------------------------------- -- Exceptions defined in the resource set package ---------------------------------------------------------- -- Try to get/set a unkwon parameter -- Invalid_Parameter : exception; -- The the resource name does ot exist in the set -- Resource_Not_Found : exception; -- all the resource accessed by a task should have -- the same protocol type -- Can_Not_Used_Different_Protocol : exception; ---------------------------------------------------------- -- I/O operations ---------------------------------------------------------- function Export_Aadl_Implementations (My_Resources : in Resources_Set) return Unbounded_String; function Export_Aadl_Declarations (My_Resources : in Resources_Set; Address_Space_Name : in Unbounded_String; Number_Of_Ht : in Natural) return Unbounded_String; function Export_Aadl_Connections (My_Resources : in Resources_Set; A_Task_Name : in Unbounded_String; Number_Of_Ht : in Natural) return Unbounded_String; ---------------------------------------------------------- -- Procedure to perform modification on a set ---------------------------------------------------------- procedure Task_Begin_End (Task_Name : in Unbounded_String; Resource_Name : in Unbounded_String; A_Resource_Set : in Resources_Set; Starts_Ends : in out Start_End_Table; Elements : in out Resource_accesses_Range); procedure Update_Resource (My_Resources : in out Resources_Set; Name : in Unbounded_String; State : in Integer; address : in Integer; size : in Integer; Cpu_Name : in Unbounded_String; Address_Space_Name : in Unbounded_String; Protocol : in Resources_Type; Affected_Tasks : in Resource_accesses_Table; priority : in integer; Ceiling_Priority : in Integer; priority_assignment : in Priority_Assignment_Type); procedure Check_Resource (My_Resources : in Resources_Set; Name : in Unbounded_String; State : in Integer; address : in Integer; size : in Integer; Cpu_Name : in Unbounded_String; Address_Space_Name : in Unbounded_String; Protocol : in Resources_Type; Affected_Tasks : in Resource_accesses_Table; Ceiling_Priority : in Integer := 0); procedure Add_Resource (My_Resources : in out Resources_Set; Name : in Unbounded_String; State : in Integer; address : in Integer; size : in Integer; Cpu_Name : in Unbounded_String; Address_Space_Name : in Unbounded_String; Protocol : in Resources_Type; Affected_Tasks : in Resource_accesses_Table; priority : in integer; priority_assignment : in Priority_Assignment_Type; Ceiling_Priority : in Integer := 0); procedure Add_Resource (My_Resources : in out Resources_Set; A_Resource : in out Generic_Resource_Ptr; Name : in Unbounded_String; State : in Integer; address : in Integer; size : in Integer; Cpu_Name : in Unbounded_String; Address_Space_Name : in Unbounded_String; Protocol : in Resources_Type; Affected_Tasks : in Resource_accesses_Table; priority : in integer; priority_assignment : in Priority_Assignment_Type; Ceiling_Priority : in Integer := 0); procedure Delete_Task (My_Resources : in out Resources_Set; A_Task : in Unbounded_String); procedure Delete_Address_Space (My_Resources : in out Resources_Set; A_Addr : in Unbounded_String); procedure Delete_Processor (My_Resources : in out Resources_Set; A_Processor : in Unbounded_String); ------------------------------------------------------ -- Read information from a set ------------------------------------------------------ -- Get the number of tasks hosted by the -- processor "Processor_Name" -- function Get_Number_Of_Resource_From_Processor (My_Resources : in Resources_Set; Processor_Name : in Unbounded_String) return Resources_Range; -- Get the task pointer of the task named "Name" -- function Search_Resource (My_Resources : in Resources_Set; Name : in Unbounded_String) return Generic_Resource_Ptr; function Search_Resource_by_id (My_Resources : in Resources_Set; id : in Unbounded_String) return Generic_Resource_Ptr; -------------------------------------------------------- -- Functions to perform sort on a set -------------------------------------------------------- procedure Same_Protocol_Control (My_Resources : in Resources_Set; A_Task : in Unbounded_String); private type Resources_Set is new Generic_Resource_Set.set with null record; end Resource_Set;