1 using Antmicro.Renode.Core;
2 using Antmicro.Renode.Logging;
3 using Antmicro.Renode.Time;
4 using Antmicro.Renode.Peripherals.Bus;
5 
6 namespace Antmicro.Renode.Peripherals.Test
7 {
8     class ExecuteInLockPeripheral : IBytePeripheral, IKnownSize
9     {
ExecuteInLockPeripheral(Machine machine)10         public ExecuteInLockPeripheral(Machine machine)
11         {
12             this.machine = machine;
13         }
14 
Reset()15         public void Reset()
16         {
17         }
18 
ReadByte(long offset)19         public byte ReadByte(long offset)
20         {
21             return 0;
22         }
23 
WriteByte(long offset, byte value)24         public void WriteByte(long offset, byte value)
25         {
26             machine.ClockSource.ExecuteInLock(() =>
27                 {
28                     this.Log(LogLevel.Info, $"Got write request with value 0x{value:X}");
29                 });
30         }
31 
32         public long Size
33         {
34             get
35             {
36                 return 1;
37             }
38         }
39 
40         private Machine machine;
41     }
42 }
43