public Atmel91SystemTimer(Machine machine) { IRQ = new GPIO(); PeriodIntervalTimer = new LimitTimer(machine, 32768, int.MaxValue); // long.MaxValue couses crashes PeriodIntervalTimer.Value = 0x00000000; PeriodIntervalTimer.AutoUpdate = true; PeriodIntervalTimer.LimitReached += PeriodIntervalTimerAlarmHandler; WatchdogTimer = new LimitTimer(machine, 32768, int.MaxValue); WatchdogTimer.Value = 0x00020000; WatchdogTimer.AutoUpdate = true; WatchdogTimer.Divider = 128; WatchdogTimer.LimitReached += WatchdogTimerAlarmHandler; RealTimeTimer = new AT91_InterruptibleTimer(machine, 32768, BitHelper.Bits(20), Direction.Ascending); RealTimeTimer.Divider = 0x00008000; RealTimeTimer.OnUpdate += () => { lock (localLock) { if (RealtimeTimerIncrementInterruptMask) { RealTimeTimerIncrement = true; } } }; }