------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 6285, Université 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: 3657 $ -- $Date: 2020-12-13 13:25:49 +0100 (dim. 13 déc. 2020) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with Glib; use Glib; with Glib.Object; use Glib.Object; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Gtkada.Builder; use Gtkada.Builder; with graphical_editor; use graphical_editor; with graphical_editor.generic_package_widget; use graphical_editor.generic_package_widget; with graphical_editor.user_message; use graphical_editor.user_message; with graphical_editor.message_text; use graphical_editor.message_text; with graphical_editor.cheddar_callbacks; use graphical_editor.cheddar_callbacks; with Doubles; use Doubles; with editor_config; use editor_config; with framework_config; use framework_config; with framework; use framework; with translate; use translate; with memory_set; use memory_set; with processor_set; use processor_set; with task_set; use task_set; with tasks; use tasks; with address_spaces; use address_spaces; with address_space_set; use address_space_set; with memories; use memories; with processors; use processors; with core_units; use core_units; use core_units.Core_Units_Table_Package; with systems; use systems; with scheduler_interface; use scheduler_interface; package body graphical_editor.wizard_callbacks is procedure ok (object : access gtkada_builder_record'class) is ok : Boolean; textbuffer_string : Unbounded_String; my_widget : gobject; number_of_task : integer :=0; number_of_processor : integer :=0; core1, core2 : core_unit_ptr; a_memory_table : memories_table; a_core_table : core_units_table; begin clear_workspace; textbuffer_string := get_value_buffer_string (gtk_text_buffer (Get_Object (object, "textbuffer1"))); if textbuffer_string = "" then number_of_processor:= 0; else to_integer (textbuffer_string, number_of_processor, ok); if not ok then show_message_box (lb_number_of_processor(current_language) & lb_must_be_numeric (current_language)); return; end if; end if; textbuffer_string := get_value_buffer_string (gtk_text_buffer (Get_Object (object, "textbuffer2"))); if textbuffer_string = "" then number_of_task:= 0; else to_integer (textbuffer_string, number_of_task, ok); if not ok then show_message_box (lb_number_of_task(current_language) & lb_must_be_numeric (current_language)); return; end if; end if; initialize(sys); add_core_unit (sys.core_units, core1, to_unbounded_string("core1"), preemptive, 0, 1, 0,0,0, empty_string, empty_string, rate_monotonic_protocol, a_memory_table); add_core_unit (sys.core_units, core2, to_unbounded_string("core2"), preemptive, 0, 1, 0,0,0, empty_string, empty_string, rate_monotonic_protocol, a_memory_table); add(a_core_table, core1); add(a_core_table, core2); for i in 1..number_of_processor loop add_processor (sys.processors, to_unbounded_string("unicore_cpu") & suppress_space(to_unbounded_string(i'img)), core1); add_processor (sys.processors, to_unbounded_string("dualcore_cpu") & suppress_space(to_unbounded_string(i'img)), a_core_table); add_address_space (sys.address_spaces, to_unbounded_string("ea_unicore") & suppress_space(to_unbounded_string(i'img)), to_unbounded_string("unicore_cpu") & suppress_space(to_unbounded_string(i'img)), 0,0,0,0); add_address_space (sys.address_spaces, to_unbounded_string("ea_dualcore") & suppress_space(to_unbounded_string(i'img)), to_unbounded_string("dualcore_cpu") & suppress_space(to_unbounded_string(i'img)), 0,0,0,0); end loop; for i in 1..number_of_task loop add_task (sys.tasks, to_unbounded_string("T") & suppress_space(to_unbounded_string(i'img)), to_unbounded_string("unicore_cpu1"), to_unbounded_string("ea_unicore1"), empty_string, periodic_type, 0, 1, 10, 10, 0, 0, 1, 0, sched_fifo); end loop; do_wizard; starting_text; my_widget := Get_Object (object, "window1"); Destroy (gtk_widget (my_widget)); Gtk.Main.Main_Quit; end ok; procedure cancel (object : access gtkada_builder_record'class) is my_widget : gobject; begin my_widget := Get_Object (object, "window1"); Destroy (gtk_widget (my_widget)); Gtk.Main.Main_Quit; end cancel; end graphical_editor.wizard_callbacks;