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 System.Collections.Generic;
11 using Antmicro.Renode.Peripherals.Bus;
12 using System.Collections.ObjectModel;
13 
14 namespace Antmicro.Renode.UnitTests.Mocks
15 {
16     public class MockGPIOByNumberConnectorPeripheral : INumberedGPIOOutput, IGPIOReceiver, IBytePeripheral
17     {
MockGPIOByNumberConnectorPeripheral(int gpios)18         public MockGPIOByNumberConnectorPeripheral(int gpios)
19         {
20             var innerConnections = new Dictionary<int, IGPIO>();
21             for(int i = 0; i < gpios; i++)
22             {
23                 innerConnections[i] = new GPIO();
24             }
25             Connections = new ReadOnlyDictionary<int, IGPIO>(innerConnections);
26             Irq = new GPIO();
27             OtherIrq = new GPIO();
28         }
29 
Reset()30         public void Reset()
31         {
32             throw new NotImplementedException();
33         }
34 
35         public IReadOnlyDictionary<int, IGPIO> Connections { get; private set; }
36 
OnGPIO(int number, bool value)37         public void OnGPIO(int number, bool value)
38         {
39 
40         }
41 
ReadByte(long offset)42         public byte ReadByte(long offset)
43         {
44             throw new NotImplementedException();
45         }
46 
WriteByte(long offset, byte value)47         public void WriteByte(long offset, byte value)
48         {
49             throw new NotImplementedException();
50         }
51 
52         public GPIO Irq { get; private set; }
53 
54         public GPIO OtherIrq { get; private set; }
55     }
56 }
57 
58