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 Antmicro.Renode.Core; 9 10 namespace Antmicro.Renode.Peripherals.Timers 11 { 12 public sealed class CC2538Watchdog : SimpleTicker, IKnownSize 13 { CC2538Watchdog(ulong periodInMs, IMachine machine)14 public CC2538Watchdog(ulong periodInMs, IMachine machine) : base(periodInMs, machine) 15 { 16 Reset(); 17 } 18 WriteDoubleWord(long offset, uint value)19 public override void WriteDoubleWord(long offset, uint value) 20 { 21 if(value == 0x5 && previousValue == 0xA) 22 { 23 Reset(); 24 } 25 else 26 { 27 previousValue = value; 28 } 29 } 30 Reset()31 public override void Reset() 32 { 33 previousValue = 0; 34 base.Reset(); 35 } 36 37 public long Size 38 { 39 get 40 { 41 return 0x4; 42 } 43 } 44 45 private uint previousValue; 46 } 47 } 48 49