diff --git a/emulation/peripherals/BetrustedI2C.cs b/emulation/peripherals/BetrustedSocI2C.cs similarity index 94% rename from emulation/peripherals/BetrustedI2C.cs rename to emulation/peripherals/BetrustedSocI2C.cs index 6ce69496d..db6f68b9f 100644 --- a/emulation/peripherals/BetrustedI2C.cs +++ b/emulation/peripherals/BetrustedSocI2C.cs @@ -19,9 +19,9 @@ using Antmicro.Renode.Utilities; namespace Antmicro.Renode.Peripherals.I2C { [AllowedTranslations(AllowedTranslation.ByteToDoubleWord)] - public class BetrustedI2C : SimpleContainer, IDoubleWordPeripheral, IKnownSize + public class BetrustedSocI2C : SimpleContainer, IDoubleWordPeripheral, IKnownSize { - public BetrustedI2C(Machine machine) : base(machine) + public BetrustedSocI2C(Machine machine) : base(machine) { dataToSlave = new Queue(); dataFromSlave = new Queue(); @@ -58,14 +58,6 @@ namespace Antmicro.Renode.Peripherals.I2C .WithFlag(0, out i2cIntIrqStatus, FieldMode.Read) }, - {(long)Registers.CoreReset, new DoubleWordRegister(this) - .WithFlag(0, FieldMode.Write, writeCallback: (_, do_it) => { - if (do_it) { - Reset(); - } - }) - }, - {(long)Registers.EventStatus, new DoubleWordRegister(this) .WithFlag(1, FieldMode.Read, name: "TX_RX_DONE_STATUS", valueProviderCallback: _ => txRxDoneIrqStatus) .WithFlag(0, FieldMode.Read, name: "I2C_INT_STATUS", valueProviderCallback: _ => i2cIntIrqStatus.Value) @@ -192,17 +184,16 @@ namespace Antmicro.Renode.Peripherals.I2C private void UpdateInterrupts() { - if (i2cIntIrqStatus.Value) + if (i2cIntIrqStatus.Value && i2cIntIrqEnabled.Value) { i2cIntIrqPending.Value = true; } - if (txRxDoneIrqStatus) + if (txRxDoneIrqStatus && txRxDoneIrqEnabled.Value) { txRxDoneIrqPending.Value = true; } // this.Log(LogLevel.Noisy, " Setting status: {0}, enabled: {1}, pending: {2}", txRxDoneIrqStatus, txRxDoneIrqEnabled.Value, txRxDoneIrqPending.Value); - IRQ.Set((i2cIntIrqPending.Value && txRxDoneIrqEnabled.Value) - || (txRxDoneIrqPending.Value && i2cIntIrqEnabled.Value)); + IRQ.Set(i2cIntIrqPending.Value || txRxDoneIrqPending.Value); } public GPIO IRQ @@ -304,7 +295,7 @@ namespace Antmicro.Renode.Peripherals.I2C Receive = 0xC, Command = 0x10, Status = 0x14, - CoreReset = 0x18, + Reset = 0x18, EventStatus = 0x1c, EventPending = 0x20, EventEnable = 0x24 diff --git a/emulation/soc/betrusted-soc.repl b/emulation/soc/betrusted-soc.repl index f8f6b39c6..54ab4774a 100755 --- a/emulation/soc/betrusted-soc.repl +++ b/emulation/soc/betrusted-soc.repl @@ -34,7 +34,7 @@ memlcd: Video.BetrustedLCD @ sysbus 0xf000c000 // Unrecognized peripheral: com @ 0xf000d000 -i2c: I2C.BetrustedI2C @ sysbus 0xf000e000 +i2c: I2C.BetrustedSocI2C @ sysbus 0xf000e000 -> cpu @ 1006 // Unrecognized peripheral: btevents @ 0xf000f000 diff --git a/emulation/xous-release.resc b/emulation/xous-release.resc index aa2dc8e74..682f6b219 100644 --- a/emulation/xous-release.resc +++ b/emulation/xous-release.resc @@ -10,7 +10,7 @@ using sysbus # if you modify these files. i @peripherals/ABRTCMC.cs i @peripherals/BetrustedEcI2C.cs -i @peripherals/BetrustedI2C.cs +i @peripherals/BetrustedSocI2C.cs i @peripherals/BetrustedWatchdog.cs i @peripherals/BQ27421.cs i @peripherals/engine.cs @@ -37,6 +37,7 @@ showAnalyzer memlcd # sysbus LogPeripheralAccess engine true # sysbus LogPeripheralAccess sha512 true +# sysbus LogPeripheralAccess i2c true # sysbus LogPeripheralAccess trng_kernel true sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer" @@ -45,7 +46,7 @@ sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer" # logLevel -1 ticktimer # logLevel -1 engine # logLevel -1 i2c -# logLevel -1 abracom_rtc +# logLevel -1 i2c.abracom_rtc # logLevel -1 sha512 # Silence COM and WDT and WFI @@ -78,6 +79,9 @@ mach clear ############### Define the Betrusted EC ############### mach create "EC" machine LoadPlatformDescription @ec/betrusted-ec.repl + +# logLevel -1 i2c.bq27421 + showAnalyzer uart macro reset """ @@ -86,8 +90,6 @@ macro reset """ runMacro $reset -logLevel -1 bq27421 - mach clear start diff --git a/svd2repl/src/generate.rs b/svd2repl/src/generate.rs index c448921b7..e05fbdb1e 100644 --- a/svd2repl/src/generate.rs +++ b/svd2repl/src/generate.rs @@ -633,7 +633,7 @@ pub fn generate(src: T, dest: &mut U) -> Result<(), ParseErro cs_peripherals.insert("app_uart", "UART.LiteX_UART"); cs_peripherals.insert("console", "UART.LiteX_UART"); cs_peripherals.insert("engine", "Miscellaneous.Engine"); - cs_peripherals.insert("i2c", "I2C.BetrustedI2C"); + cs_peripherals.insert("i2c", "I2C.BetrustedSocI2C"); cs_peripherals.insert("keyboard", "Input.BetrustedKbd"); cs_peripherals.insert("keyrom", "Miscellaneous.Keyrom"); cs_peripherals.insert("memlcd", "Video.BetrustedLCD");