------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR CNRS 6285, Universite de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- 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$ -- $Date$ -- $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 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; 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; Priority : in Integer); 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); 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); -- Search for resources referencing an address space -- procedure Check_entity_referencing_Address_Space (My_resources : in resources_Set; A_Addr : in Unbounded_String); procedure Check_entity_referencing_processor (My_resources : in resources_Set; A_processor : in Unbounded_String); procedure Check_entity_referencing_task (My_resources : in resources_Set; A_task : in Unbounded_String); -- Delete all resources that are used by the task 'a_task' -- procedure Delete_Task (My_Resources : in out Resources_Set; A_Task : in Unbounded_String); -- Delete all resources that are located on the address space 'a_addr' -- procedure Delete_Address_Space (My_Resources : in out Resources_Set; A_Addr : in Unbounded_String); -- Delete all resources that are located on the processor 'a_processor' -- 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 resource pointer of the resource named "Name" -- function Search_Resource (My_Resources : in Resources_Set; Name : in Unbounded_String) return Generic_Resource_Ptr; -- SR append for binding function Resource_Is_Present (My_Resources : in Resources_Set; Name : in Unbounded_String) return Boolean; 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;