mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +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;
|
||||
secondByte = false;
|
||||
Temperature = 298.1M;
|
||||
Voltage = 3700;
|
||||
Voltage = 4000;
|
||||
SoC = 90;
|
||||
AvgCur = 300;
|
||||
RemainingCapacity = 4000;
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
|||
public void Reset()
|
||||
{
|
||||
State = JtagState.TestLogicReset;
|
||||
RegistersCollection.Reset();
|
||||
}
|
||||
|
||||
private enum JtagState
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ namespace Antmicro.Renode.Peripherals.Timers
|
|||
latchedValue = 0;
|
||||
loadValue = 0;
|
||||
reloadValue = 0;
|
||||
RegistersCollection.Reset();
|
||||
|
||||
UpdateInterrupts();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,6 +594,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
|||
{
|
||||
this.powerIsOn.Value = false;
|
||||
}
|
||||
RegistersCollection.Reset();
|
||||
}
|
||||
|
||||
private readonly Machine machine;
|
||||
|
|
|
|||
|
|
@ -323,6 +323,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
|||
{
|
||||
this.sha512.Initialize();
|
||||
this.digestedLength = 0;
|
||||
RegistersCollection.Reset();
|
||||
}
|
||||
|
||||
private readonly Machine machine;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
|
|||
this.softintStatus = false;
|
||||
this.softintPending.Value = false;
|
||||
this.softintEnabled.Value = false;
|
||||
RegistersCollection.Reset();
|
||||
}
|
||||
|
||||
public GPIO IRQ { get; private set; }
|
||||
|
|
|
|||
|
|
@ -118,7 +118,15 @@ namespace Antmicro.Renode.Peripherals.Timers
|
|||
;
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace Antmicro.Renode.Peripherals.Timers
|
|||
tickValue = 0;
|
||||
paused = true;
|
||||
msleepTarget = 0;
|
||||
RegistersCollection.Reset();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
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)
|
||||
.WithValueField(0, 32, FieldMode.Read, name: "Time1", valueProviderCallback: _ =>
|
||||
{
|
||||
return (uint)(tickValue >> 32);
|
||||
return Time1();
|
||||
})
|
||||
;
|
||||
|
||||
Registers.Time0.Define32(this)
|
||||
.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 bool irqStatus;
|
||||
|
||||
bool paused;
|
||||
long tickValue;
|
||||
public bool paused;
|
||||
public long tickValue;
|
||||
ulong msleepTarget;
|
||||
public GPIO IRQ { get; private set; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue