1 // 2 // Copyright (c) 2010-2024 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 using System; 9 using Antmicro.Renode.Core; 10 using Antmicro.Renode.UserInterface.Tokenizer; 11 using AntShell.Commands; 12 13 namespace Antmicro.Renode.UserInterface.Commands 14 { 15 public class StartCommand : Command 16 { 17 PrintHelp(ICommandInteraction writer)18 public override void PrintHelp(ICommandInteraction writer) 19 { 20 base.PrintHelp(writer); 21 writer.WriteLine(); 22 writer.WriteLine("Usage:"); 23 writer.WriteLine(String.Format("{0} - starts the whole emulation", Name)); 24 writer.WriteLine(String.Format("{0} @path - executes the script and starts the emulation", Name)); 25 } 26 27 [Runnable] Run(ICommandInteraction writer)28 public void Run(ICommandInteraction writer) 29 { 30 writer.WriteLine("Starting emulation..."); 31 EmulationManager.Instance.CurrentEmulation.StartAll(); 32 } 33 34 [Runnable] Run(ICommandInteraction writer, StringToken path)35 public void Run(ICommandInteraction writer, StringToken path) 36 { 37 if(IncludeCommand.Run(writer, path)) 38 { 39 EmulationManager.Instance.CurrentEmulation.StartAll(); 40 } 41 } 42 43 private readonly IncludeFileCommand IncludeCommand; 44 StartCommand(Monitor monitor, IncludeFileCommand includeCommand)45 public StartCommand(Monitor monitor, IncludeFileCommand includeCommand) : base(monitor, "start", "starts the emulation.", "s") 46 { 47 if(includeCommand == null) 48 { 49 throw new ArgumentException("includeCommand cannot be null.", "includeCommand"); 50 } 51 IncludeCommand = includeCommand; 52 } 53 } 54 } 55 56