From 5c52fbd52289e67590a6128b6670b68db8202dcd Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 6 Apr 2023 09:27:13 +0800 Subject: [PATCH] emulation: fix renode compatibility for peripherals Many of the devicse have changed from `uint` to `ulong`, so forward-port the peripherals to work with the new format. Signed-off-by: Sean Cross --- emulation/peripherals/BetrustedSpinor.cs | 2 +- emulation/peripherals/BetrustedWatchdog.cs | 4 ++-- emulation/peripherals/LiteX_Timer_32.cs | 4 ++-- emulation/peripherals/WF200.cs | 3 +-- emulation/peripherals/keyrom.cs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/emulation/peripherals/BetrustedSpinor.cs b/emulation/peripherals/BetrustedSpinor.cs index ec4a81f22..bca711ca7 100644 --- a/emulation/peripherals/BetrustedSpinor.cs +++ b/emulation/peripherals/BetrustedSpinor.cs @@ -148,7 +148,7 @@ namespace Antmicro.Renode.Peripherals.SPI.Betrusted } } - private void HandleTxFifoWrite(uint value) + private void HandleTxFifoWrite(ulong value) { txQueue.Enqueue((byte)(value)); txQueue.Enqueue((byte)(value >> 8)); diff --git a/emulation/peripherals/BetrustedWatchdog.cs b/emulation/peripherals/BetrustedWatchdog.cs index 1f852288b..7b2d0ea23 100644 --- a/emulation/peripherals/BetrustedWatchdog.cs +++ b/emulation/peripherals/BetrustedWatchdog.cs @@ -77,9 +77,9 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted } // Convert "approximately 65MHz" ticks to milliseconds - private uint XilinxClockToMs(uint xilinx_clocks) + private uint XilinxClockToMs(ulong xilinx_clocks) { - uint adjusted = (uint)((((ulong)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); return adjusted; } diff --git a/emulation/peripherals/LiteX_Timer_32.cs b/emulation/peripherals/LiteX_Timer_32.cs index d458cb2d6..c85124a20 100644 --- a/emulation/peripherals/LiteX_Timer_32.cs +++ b/emulation/peripherals/LiteX_Timer_32.cs @@ -113,8 +113,8 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted private IFlagRegisterField irqPending; private uint latchedValue; - private uint loadValue; - private uint reloadValue; + private ulong loadValue; + private ulong reloadValue; private readonly LimitTimer innerTimer; diff --git a/emulation/peripherals/WF200.cs b/emulation/peripherals/WF200.cs index 92cd5534d..0857b4b51 100644 --- a/emulation/peripherals/WF200.cs +++ b/emulation/peripherals/WF200.cs @@ -806,7 +806,7 @@ namespace Antmicro.Renode.Peripherals.Network.Betrusted } } - private uint GetWriteRegister(uint val, uint order) + private uint GetWriteRegister(uint val, ulong order) { if (order == 0) { @@ -1214,4 +1214,3 @@ namespace Antmicro.Renode.Peripherals.Network.Betrusted } } - diff --git a/emulation/peripherals/keyrom.cs b/emulation/peripherals/keyrom.cs index 30bd41e4c..e0e51884f 100644 --- a/emulation/peripherals/keyrom.cs +++ b/emulation/peripherals/keyrom.cs @@ -326,7 +326,7 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous.Betrusted this.lockAddress = 0; } - private uint address; + private ulong address; private UInt32[] data; private bool[] locked; private uint lockAddress;