mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
emulation: ensure peripherals are reset
Add a `Reset()` call to many more peripherals to ensure they are reset when the board is reset. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
d7c2033273
commit
2979f4453f
8 changed files with 30 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ namespace Antmicro.Renode.Peripherals.Sensors
|
||||||
firstByte = true;
|
firstByte = true;
|
||||||
secondByte = false;
|
secondByte = false;
|
||||||
Temperature = 298.1M;
|
Temperature = 298.1M;
|
||||||
Voltage = 3700;
|
Voltage = 4000;
|
||||||
SoC = 90;
|
SoC = 90;
|
||||||
AvgCur = 300;
|
AvgCur = 300;
|
||||||
RemainingCapacity = 4000;
|
RemainingCapacity = 4000;
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
State = JtagState.TestLogicReset;
|
State = JtagState.TestLogicReset;
|
||||||
|
RegistersCollection.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum JtagState
|
private enum JtagState
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
latchedValue = 0;
|
latchedValue = 0;
|
||||||
loadValue = 0;
|
loadValue = 0;
|
||||||
reloadValue = 0;
|
reloadValue = 0;
|
||||||
|
RegistersCollection.Reset();
|
||||||
|
|
||||||
UpdateInterrupts();
|
UpdateInterrupts();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -594,6 +594,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||||
{
|
{
|
||||||
this.powerIsOn.Value = false;
|
this.powerIsOn.Value = false;
|
||||||
}
|
}
|
||||||
|
RegistersCollection.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Machine machine;
|
private readonly Machine machine;
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||||
{
|
{
|
||||||
this.sha512.Initialize();
|
this.sha512.Initialize();
|
||||||
this.digestedLength = 0;
|
this.digestedLength = 0;
|
||||||
|
RegistersCollection.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Machine machine;
|
private readonly Machine machine;
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||||
this.softintStatus = false;
|
this.softintStatus = false;
|
||||||
this.softintPending.Value = false;
|
this.softintPending.Value = false;
|
||||||
this.softintEnabled.Value = false;
|
this.softintEnabled.Value = false;
|
||||||
|
RegistersCollection.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPIO IRQ { get; private set; }
|
public GPIO IRQ { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,15 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.Powerdown.Define32(this)
|
Registers.Powerdown.Define32(this)
|
||||||
.WithFlag(0, FieldMode.Read | FieldMode.Write)
|
.WithFlag(0, FieldMode.Read | FieldMode.Write, changeCallback: (_, val) => {
|
||||||
|
if (val) {
|
||||||
|
this.Log(LogLevel.Info, "Pausing and resetting machine");
|
||||||
|
machine.LocalTimeSource.ExecuteInNearestSyncedState(ts => {
|
||||||
|
machine.Pause();
|
||||||
|
machine.Reset();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.Wfi.Define32(this)
|
Registers.Wfi.Define32(this)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
tickValue = 0;
|
tickValue = 0;
|
||||||
paused = true;
|
paused = true;
|
||||||
msleepTarget = 0;
|
msleepTarget = 0;
|
||||||
|
RegistersCollection.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTick()
|
private void OnTick()
|
||||||
|
|
@ -45,6 +46,16 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint Time0()
|
||||||
|
{
|
||||||
|
return (uint)(tickValue >> 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint Time1()
|
||||||
|
{
|
||||||
|
return (uint)(tickValue >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateInterrupts()
|
private void UpdateInterrupts()
|
||||||
{
|
{
|
||||||
if ((Interlocked.Read(ref this.tickValue) >= (long)this.msleepTarget) && this.irqEnabled.Value)
|
if ((Interlocked.Read(ref this.tickValue) >= (long)this.msleepTarget) && this.irqEnabled.Value)
|
||||||
|
|
@ -77,14 +88,14 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
Registers.Time1.Define32(this)
|
Registers.Time1.Define32(this)
|
||||||
.WithValueField(0, 32, FieldMode.Read, name: "Time1", valueProviderCallback: _ =>
|
.WithValueField(0, 32, FieldMode.Read, name: "Time1", valueProviderCallback: _ =>
|
||||||
{
|
{
|
||||||
return (uint)(tickValue >> 32);
|
return Time1();
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.Time0.Define32(this)
|
Registers.Time0.Define32(this)
|
||||||
.WithValueField(0, 32, FieldMode.Read, name: "Time0", valueProviderCallback: _ =>
|
.WithValueField(0, 32, FieldMode.Read, name: "Time0", valueProviderCallback: _ =>
|
||||||
{
|
{
|
||||||
return (uint)(tickValue >> 0);
|
return Time0();
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -131,8 +142,8 @@ namespace Antmicro.Renode.Peripherals.Timers
|
||||||
private IFlagRegisterField irqPending;
|
private IFlagRegisterField irqPending;
|
||||||
private bool irqStatus;
|
private bool irqStatus;
|
||||||
|
|
||||||
bool paused;
|
public bool paused;
|
||||||
long tickValue;
|
public long tickValue;
|
||||||
ulong msleepTarget;
|
ulong msleepTarget;
|
||||||
public GPIO IRQ { get; private set; }
|
public GPIO IRQ { get; private set; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue