------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, 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 README.md -- -- 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: 4589 $ -- $Date: 2023-09-29 16:02:19 +0200 (ven. 29 sept. 2023) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with scheduler; use scheduler; with unbounded_strings; use unbounded_strings; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; --------------------------------------------------------------------- -- Package Marzhin_Utils -- This package is used to provide a translation of Cheddar events -- format to Marzhin events format since cheddar is currently for -- test and study purpose replacing Marzhin in AADLInspector, -- avoiding modifications on AADLInspector side. --------------------------------------------------------------------- package Marzhin_Utils is --------------------------------------------------------------------- -- This type can be used in order to simulate the require resource -- event from Marzhin. --------------------------------------------------------------------- type port_data is record Task_Data : Unbounded_String; Resource_Data : Unbounded_String; State_Data : Unbounded_String; end record; type my_array is array (Natural range <>) of port_data; type port_list is record Port_Nb : Natural := 0; Port_Array : my_array (0 .. 10); end record; Ports : port_list; --------------------------------------------------------------------- -- Add_Port -- Purpose: Add a marzhin port event to the port list. -- Was used for debug of events communication. -- Still can be useful to "simulate" port_events. --------------------------------------------------------------------- -- procedure Add_Port ( -- Task_Name : in Unbounded_String; -- Resource_Name : in Unbounded_String; -- State_Value : in Unbounded_String); --------------------------------------------------------------------- -- Encode_Task_Capacities -- Purpose: Encode and return the table of tasks capacities. --------------------------------------------------------------------- function Encode_Task_Capacities (Si : scheduling_information) return Unbounded_String; --------------------------------------------------------------------- -- Get_Event_String_From_XML -- Purpose: Extract the cheddar event name from an xml formatted string. --------------------------------------------------------------------- procedure Get_Event_String_From_XML (XML_String : in Unbounded_String; Event_String : in out Unbounded_String); --------------------------------------------------------------------- -- Get_Resource_Id_From_XML -- Purpose: Extract the cheddar id from a resource from an xml -- formatted string. --------------------------------------------------------------------- procedure Get_Resource_Id_From_XML (XML_String : in Unbounded_String; Event_String : in Unbounded_String; Resource_Id_String : in out Unbounded_String); --------------------------------------------------------------------- -- Get_Task_Id_From_XML -- Purpose: Extract the cheddar id from a task from an xml -- formatted string. --------------------------------------------------------------------- procedure Get_Task_Id_From_XML (XML_String : in Unbounded_String; Event_String : in Unbounded_String; Task_Id_String : in out Unbounded_String); --------------------------------------------------------------------- -- Is_Resource_Event -- Purpose: Check if the event concern's a resource. --------------------------------------------------------------------- function Is_Resource_Event (Event_String : in Unbounded_String) return Boolean; --------------------------------------------------------------------- -- Set_To_Marzhin_Event -- Purpose: Transform a cheddar event name to a marzhin event name. --------------------------------------------------------------------- procedure Set_To_Marzhin_Event (Event_String : in out Unbounded_String); --------------------------------------------------------------------- -- Set_To_Marzhin_Resource_Event -- Purpose: Transform a resource event to a marzhin lock/unlock -- event. --------------------------------------------------------------------- procedure Set_To_Marzhin_Resource_Event (Event_String : in out Unbounded_String); --------------------------------------------------------------------- -- To_Marzhin_Output_Format -- Purpose: Since we are replacing Marzhin simulator in AADLInspector -- and trying to reduce the code modifications on the AADLInspector -- side, the message provided to AADLInspector will have the same -- format protocol that the Marzhin output. --------------------------------------------------------------------- function To_Marzhin_Output_Format (Tick : in Natural; Event : in Unbounded_String; Data : in Unbounded_String) return Unbounded_String; end Marzhin_Utils;