1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 using System; 8 using Antmicro.Renode.Core.Structure; 9 using Antmicro.Renode.Peripherals.Bus; 10 11 namespace Antmicro.Renode.UnitTests.Mocks 12 { 13 public class AmbiguousRegister : IPeripheralRegister<IDoubleWordPeripheral, BusPointRegistration>, IPeripheralRegister<IDoubleWordPeripheral, DoublePointRegistration>, 14 IPeripheralRegister<IDoubleWordPeripheral, IMockRegistrationPoint1>, IPeripheralRegister<IDoubleWordPeripheral, IMockRegistrationPoint2>, 15 IPeripheralRegister<IBytePeripheral, DoublePointRegistration> 16 { Register(IDoubleWordPeripheral peripheral, DoublePointRegistration registrationPoint)17 public void Register(IDoubleWordPeripheral peripheral, DoublePointRegistration registrationPoint) 18 { 19 20 } 21 Register(IDoubleWordPeripheral peripheral, BusPointRegistration registrationPoint)22 public void Register(IDoubleWordPeripheral peripheral, BusPointRegistration registrationPoint) 23 { 24 25 } 26 Register(IDoubleWordPeripheral peripheral, IMockRegistrationPoint1 registrationPoint)27 public void Register(IDoubleWordPeripheral peripheral, IMockRegistrationPoint1 registrationPoint) 28 { 29 30 } 31 Register(IDoubleWordPeripheral peripheral, IMockRegistrationPoint2 registrationPoint)32 public void Register(IDoubleWordPeripheral peripheral, IMockRegistrationPoint2 registrationPoint) 33 { 34 35 } 36 Register(IBytePeripheral peripheral, DoublePointRegistration registrationPoint)37 public void Register(IBytePeripheral peripheral, DoublePointRegistration registrationPoint) 38 { 39 40 } 41 Unregister(IDoubleWordPeripheral peripheral)42 public void Unregister(IDoubleWordPeripheral peripheral) 43 { 44 45 } 46 Unregister(IBytePeripheral peripheral)47 public void Unregister(IBytePeripheral peripheral) 48 { 49 50 } 51 } 52 53 public class DoublePointRegistration : IRegistrationPoint 54 { DoublePointRegistration(double from)55 public DoublePointRegistration(double from) 56 { 57 this.from = from; 58 } 59 60 public string PrettyString 61 { 62 get 63 { 64 return from.ToString(); 65 } 66 } 67 68 private readonly double from; 69 } 70 71 public class MockRegistrationPoint : IRegistrationPoint, IMockRegistrationPoint1, IMockRegistrationPoint2 72 { 73 public string PrettyString 74 { 75 get 76 { 77 return ""; 78 } 79 } 80 } 81 82 public interface IMockRegistrationPoint1 : IRegistrationPoint 83 { 84 85 } 86 87 public interface IMockRegistrationPoint2 : IRegistrationPoint 88 { 89 90 } 91 } 92