mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
emulation: fix betrustedsoci2c implementation
This fixes the RTC, which gets things working again. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
9f46fbdcb3
commit
b8c23af4fd
4 changed files with 14 additions and 21 deletions
|
|
@ -19,9 +19,9 @@ using Antmicro.Renode.Utilities;
|
||||||
namespace Antmicro.Renode.Peripherals.I2C
|
namespace Antmicro.Renode.Peripherals.I2C
|
||||||
{
|
{
|
||||||
[AllowedTranslations(AllowedTranslation.ByteToDoubleWord)]
|
[AllowedTranslations(AllowedTranslation.ByteToDoubleWord)]
|
||||||
public class BetrustedI2C : SimpleContainer<II2CPeripheral>, IDoubleWordPeripheral, IKnownSize
|
public class BetrustedSocI2C : SimpleContainer<II2CPeripheral>, IDoubleWordPeripheral, IKnownSize
|
||||||
{
|
{
|
||||||
public BetrustedI2C(Machine machine) : base(machine)
|
public BetrustedSocI2C(Machine machine) : base(machine)
|
||||||
{
|
{
|
||||||
dataToSlave = new Queue<byte>();
|
dataToSlave = new Queue<byte>();
|
||||||
dataFromSlave = new Queue<byte>();
|
dataFromSlave = new Queue<byte>();
|
||||||
|
|
@ -58,14 +58,6 @@ namespace Antmicro.Renode.Peripherals.I2C
|
||||||
.WithFlag(0, out i2cIntIrqStatus, FieldMode.Read)
|
.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)
|
{(long)Registers.EventStatus, new DoubleWordRegister(this)
|
||||||
.WithFlag(1, FieldMode.Read, name: "TX_RX_DONE_STATUS", valueProviderCallback: _ => txRxDoneIrqStatus)
|
.WithFlag(1, FieldMode.Read, name: "TX_RX_DONE_STATUS", valueProviderCallback: _ => txRxDoneIrqStatus)
|
||||||
.WithFlag(0, FieldMode.Read, name: "I2C_INT_STATUS", valueProviderCallback: _ => i2cIntIrqStatus.Value)
|
.WithFlag(0, FieldMode.Read, name: "I2C_INT_STATUS", valueProviderCallback: _ => i2cIntIrqStatus.Value)
|
||||||
|
|
@ -192,17 +184,16 @@ namespace Antmicro.Renode.Peripherals.I2C
|
||||||
|
|
||||||
private void UpdateInterrupts()
|
private void UpdateInterrupts()
|
||||||
{
|
{
|
||||||
if (i2cIntIrqStatus.Value)
|
if (i2cIntIrqStatus.Value && i2cIntIrqEnabled.Value)
|
||||||
{
|
{
|
||||||
i2cIntIrqPending.Value = true;
|
i2cIntIrqPending.Value = true;
|
||||||
}
|
}
|
||||||
if (txRxDoneIrqStatus)
|
if (txRxDoneIrqStatus && txRxDoneIrqEnabled.Value)
|
||||||
{
|
{
|
||||||
txRxDoneIrqPending.Value = true;
|
txRxDoneIrqPending.Value = true;
|
||||||
}
|
}
|
||||||
// this.Log(LogLevel.Noisy, " Setting status: {0}, enabled: {1}, pending: {2}", txRxDoneIrqStatus, txRxDoneIrqEnabled.Value, txRxDoneIrqPending.Value);
|
// this.Log(LogLevel.Noisy, " Setting status: {0}, enabled: {1}, pending: {2}", txRxDoneIrqStatus, txRxDoneIrqEnabled.Value, txRxDoneIrqPending.Value);
|
||||||
IRQ.Set((i2cIntIrqPending.Value && txRxDoneIrqEnabled.Value)
|
IRQ.Set(i2cIntIrqPending.Value || txRxDoneIrqPending.Value);
|
||||||
|| (txRxDoneIrqPending.Value && i2cIntIrqEnabled.Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPIO IRQ
|
public GPIO IRQ
|
||||||
|
|
@ -304,7 +295,7 @@ namespace Antmicro.Renode.Peripherals.I2C
|
||||||
Receive = 0xC,
|
Receive = 0xC,
|
||||||
Command = 0x10,
|
Command = 0x10,
|
||||||
Status = 0x14,
|
Status = 0x14,
|
||||||
CoreReset = 0x18,
|
Reset = 0x18,
|
||||||
EventStatus = 0x1c,
|
EventStatus = 0x1c,
|
||||||
EventPending = 0x20,
|
EventPending = 0x20,
|
||||||
EventEnable = 0x24
|
EventEnable = 0x24
|
||||||
|
|
@ -34,7 +34,7 @@ memlcd: Video.BetrustedLCD @ sysbus 0xf000c000
|
||||||
|
|
||||||
// Unrecognized peripheral: com @ 0xf000d000
|
// Unrecognized peripheral: com @ 0xf000d000
|
||||||
|
|
||||||
i2c: I2C.BetrustedI2C @ sysbus 0xf000e000
|
i2c: I2C.BetrustedSocI2C @ sysbus 0xf000e000
|
||||||
-> cpu @ 1006
|
-> cpu @ 1006
|
||||||
|
|
||||||
// Unrecognized peripheral: btevents @ 0xf000f000
|
// Unrecognized peripheral: btevents @ 0xf000f000
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ using sysbus
|
||||||
# if you modify these files.
|
# if you modify these files.
|
||||||
i @peripherals/ABRTCMC.cs
|
i @peripherals/ABRTCMC.cs
|
||||||
i @peripherals/BetrustedEcI2C.cs
|
i @peripherals/BetrustedEcI2C.cs
|
||||||
i @peripherals/BetrustedI2C.cs
|
i @peripherals/BetrustedSocI2C.cs
|
||||||
i @peripherals/BetrustedWatchdog.cs
|
i @peripherals/BetrustedWatchdog.cs
|
||||||
i @peripherals/BQ27421.cs
|
i @peripherals/BQ27421.cs
|
||||||
i @peripherals/engine.cs
|
i @peripherals/engine.cs
|
||||||
|
|
@ -37,6 +37,7 @@ showAnalyzer memlcd
|
||||||
|
|
||||||
# sysbus LogPeripheralAccess engine true
|
# sysbus LogPeripheralAccess engine true
|
||||||
# sysbus LogPeripheralAccess sha512 true
|
# sysbus LogPeripheralAccess sha512 true
|
||||||
|
# sysbus LogPeripheralAccess i2c true
|
||||||
# sysbus LogPeripheralAccess trng_kernel true
|
# sysbus LogPeripheralAccess trng_kernel true
|
||||||
|
|
||||||
sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer"
|
sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer"
|
||||||
|
|
@ -45,7 +46,7 @@ sysbus Tag <0xB0000000, 0xB0006000> "Framebuffer"
|
||||||
# logLevel -1 ticktimer
|
# logLevel -1 ticktimer
|
||||||
# logLevel -1 engine
|
# logLevel -1 engine
|
||||||
# logLevel -1 i2c
|
# logLevel -1 i2c
|
||||||
# logLevel -1 abracom_rtc
|
# logLevel -1 i2c.abracom_rtc
|
||||||
# logLevel -1 sha512
|
# logLevel -1 sha512
|
||||||
|
|
||||||
# Silence COM and WDT and WFI
|
# Silence COM and WDT and WFI
|
||||||
|
|
@ -78,6 +79,9 @@ mach clear
|
||||||
############### Define the Betrusted EC ###############
|
############### Define the Betrusted EC ###############
|
||||||
mach create "EC"
|
mach create "EC"
|
||||||
machine LoadPlatformDescription @ec/betrusted-ec.repl
|
machine LoadPlatformDescription @ec/betrusted-ec.repl
|
||||||
|
|
||||||
|
# logLevel -1 i2c.bq27421
|
||||||
|
|
||||||
showAnalyzer uart
|
showAnalyzer uart
|
||||||
macro reset
|
macro reset
|
||||||
"""
|
"""
|
||||||
|
|
@ -86,8 +90,6 @@ macro reset
|
||||||
"""
|
"""
|
||||||
runMacro $reset
|
runMacro $reset
|
||||||
|
|
||||||
logLevel -1 bq27421
|
|
||||||
|
|
||||||
mach clear
|
mach clear
|
||||||
|
|
||||||
start
|
start
|
||||||
|
|
|
||||||
|
|
@ -633,7 +633,7 @@ pub fn generate<T: Read, U: Write>(src: T, dest: &mut U) -> Result<(), ParseErro
|
||||||
cs_peripherals.insert("app_uart", "UART.LiteX_UART");
|
cs_peripherals.insert("app_uart", "UART.LiteX_UART");
|
||||||
cs_peripherals.insert("console", "UART.LiteX_UART");
|
cs_peripherals.insert("console", "UART.LiteX_UART");
|
||||||
cs_peripherals.insert("engine", "Miscellaneous.Engine");
|
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("keyboard", "Input.BetrustedKbd");
|
||||||
cs_peripherals.insert("keyrom", "Miscellaneous.Keyrom");
|
cs_peripherals.insert("keyrom", "Miscellaneous.Keyrom");
|
||||||
cs_peripherals.insert("memlcd", "Video.BetrustedLCD");
|
cs_peripherals.insert("memlcd", "Video.BetrustedLCD");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue