mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
emulation: add RebootOnExpiry to wdt
When running the system without the UI, sometimes it's useful to avoid the WDT resetting the whole system. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
f9cf822efb
commit
7087b8f018
1 changed files with 7 additions and 3 deletions
|
|
@ -52,10 +52,13 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted
|
||||||
private void OnTick()
|
private void OnTick()
|
||||||
{
|
{
|
||||||
Interlocked.Increment(ref counter);
|
Interlocked.Increment(ref counter);
|
||||||
if (((uint)counter) >= this.reset_target)
|
if ((((uint)counter) >= reset_target) && RebootOnExpiry)
|
||||||
{
|
{
|
||||||
this.Log(LogLevel.Error, "Watchdog timer expired -- requesting system reset");
|
this.Log(LogLevel.Error, "Watchdog timer expired -- requesting system reset");
|
||||||
this.machine.RequestReset();
|
machine.RequestReset();
|
||||||
|
} else if (((uint)counter) == reset_target)
|
||||||
|
{
|
||||||
|
this.Log(LogLevel.Error, "Watchdog timer expired -- not rebooting because RebootOnExpiry is false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +82,7 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted
|
||||||
// Convert "approximately 65MHz" ticks to milliseconds
|
// Convert "approximately 65MHz" ticks to milliseconds
|
||||||
private uint XilinxClockToMs(ulong xilinx_clocks)
|
private uint XilinxClockToMs(ulong xilinx_clocks)
|
||||||
{
|
{
|
||||||
uint adjusted = (uint)((xilinx_clocks * 100) / 65000000);
|
uint adjusted = (uint)(xilinx_clocks * 100 / 65000000);
|
||||||
this.Log(LogLevel.Debug, "Watchdog timer set for {0}. Will expire after {1} msec", xilinx_clocks, adjusted * 10);
|
this.Log(LogLevel.Debug, "Watchdog timer set for {0}. Will expire after {1} msec", xilinx_clocks, adjusted * 10);
|
||||||
return adjusted;
|
return adjusted;
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +99,7 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted
|
||||||
private uint reset_target;
|
private uint reset_target;
|
||||||
private bool enabled;
|
private bool enabled;
|
||||||
private readonly DoubleWordRegisterCollection registers;
|
private readonly DoubleWordRegisterCollection registers;
|
||||||
|
public bool RebootOnExpiry = true;
|
||||||
private enum Registers
|
private enum Registers
|
||||||
{
|
{
|
||||||
Watchdog = 0x0,
|
Watchdog = 0x0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue