1 // 2 // Copyright (c) 2010-2018 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.Core.Structure; 11 12 namespace Antmicro.Renode.Peripherals.USBDeprecated 13 { 14 public static class MassStorageExtensions 15 { PendriveFromFile(this IMachine machine, string file, string name, IPeripheralRegister<IUSBPeripheral, USBRegistrationPoint> attachTo, byte port, bool persistent = true)16 public static void PendriveFromFile(this IMachine machine, string file, string name, IPeripheralRegister<IUSBPeripheral, USBRegistrationPoint> attachTo, byte port, bool persistent = true) 17 { 18 // TODO: note that port is here (or is nondefault) only due to bug/deficiency in EHCI 19 // i.e. that one cannot register by first free port 20 var pendrive = new MassStorage(file, persistent: persistent); 21 attachTo.Register(pendrive, new USBRegistrationPoint(port)); 22 machine.SetLocalName(pendrive, name); 23 } 24 } 25 } 26 27