mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
emulation: add WF200 ethernet implementation
This adds a working Ethernet implementation based on the WF200. It currently gets connected to a Linux machine running a udhcpd server, however it could also get connected to a TUN/TAP connection on Linux or Mac. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
9c1255bdd7
commit
768a7c4b0d
15 changed files with 1684 additions and 55 deletions
|
|
@ -23,6 +23,8 @@ com: SPI.BetrustedEcCom @ sysbus 0xe0005800
|
||||||
memAddr: 0xD0000000
|
memAddr: 0xD0000000
|
||||||
memSize: 0x1000
|
memSize: 0x1000
|
||||||
|
|
||||||
|
wifi: SPI.EcWifi @ sysbus 0xe0006000
|
||||||
|
|
||||||
sram: Memory.MappedMemory @ {
|
sram: Memory.MappedMemory @ {
|
||||||
sysbus 0x10000000;
|
sysbus 0x10000000;
|
||||||
sysbus 0x90000000 // shadow
|
sysbus 0x90000000 // shadow
|
||||||
|
|
@ -41,13 +43,14 @@ flash_mem: Memory.MappedMemory @ {
|
||||||
sysbus 0x20000000;
|
sysbus 0x20000000;
|
||||||
sysbus 0xA0000000 // shadow
|
sysbus 0xA0000000 // shadow
|
||||||
}
|
}
|
||||||
size: 0x00100000
|
size: 0x00200000
|
||||||
|
|
||||||
lm3509: Mocks.LM3509 @ i2c 0x36
|
lm3509: Mocks.LM3509 @ i2c 0x36
|
||||||
tusb320lai: Mocks.TUSB320LAI @ i2c 0x47
|
tusb320lai: Mocks.TUSB320LAI @ i2c 0x47
|
||||||
bq27421: Sensors.BQ27421 @ i2c 0x55
|
bq27421: Sensors.BQ27421 @ i2c 0x55
|
||||||
bq24157: Mocks.BQ24157 @ i2c 0x6a
|
bq24157: Mocks.BQ24157 @ i2c 0x6a
|
||||||
lsm6ds3: Mocks.LSM6DS3 @ i2c 0x6b
|
lsm6ds3: Mocks.LSM6DS3 @ i2c 0x6b
|
||||||
|
wf200: Network.WF200 @ wifi
|
||||||
|
|
||||||
sysbus:
|
sysbus:
|
||||||
init:
|
init:
|
||||||
|
|
|
||||||
BIN
emulation/linux-server-rootfs.jffs2
Normal file
BIN
emulation/linux-server-rootfs.jffs2
Normal file
Binary file not shown.
44
emulation/linux-server.resc
Normal file
44
emulation/linux-server.resc
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
:name: Versatile
|
||||||
|
:description: This script runs Linux on Versatile.
|
||||||
|
# log in with username "root"
|
||||||
|
|
||||||
|
using sysbus
|
||||||
|
$name?="Versatile"
|
||||||
|
mach create $name
|
||||||
|
|
||||||
|
machine LoadPlatformDescription @platforms/boards/versatile.repl
|
||||||
|
|
||||||
|
sysbus Redirect 0xC0000000 0x0 0x10000000
|
||||||
|
|
||||||
|
$bin?=@emulation/versatile-vmlinux
|
||||||
|
$rootfs?=@emulation/new-flash.jffs2
|
||||||
|
|
||||||
|
### create externals ###
|
||||||
|
|
||||||
|
showAnalyzer sysbus.uart0
|
||||||
|
|
||||||
|
emulation CreateSwitch "switch"
|
||||||
|
connector Connect smc91x switch
|
||||||
|
|
||||||
|
machine CFIFlashFromFile $rootfs 0x34000000 "flash"
|
||||||
|
# Silence the PS2 mouse
|
||||||
|
logLevel 3 kmi1.mouse
|
||||||
|
|
||||||
|
macro reset
|
||||||
|
"""
|
||||||
|
### set registers ###
|
||||||
|
|
||||||
|
sysbus.cpu SetRegisterUnsafe 0 0x0
|
||||||
|
sysbus.cpu SetRegisterUnsafe 1 0x183 # board id
|
||||||
|
sysbus.cpu SetRegisterUnsafe 2 0x100 # atags
|
||||||
|
|
||||||
|
### load binaries ###
|
||||||
|
|
||||||
|
sysbus LoadELF $bin false
|
||||||
|
|
||||||
|
sysbus LoadAtags "console=ttyAMA0,115200 root=/dev/mtdblock0 rw rootfstype=jffs2 mtdparts=armflash.0:64m@0x0 earlyprintk mem=256M" 0x10000000 0x100
|
||||||
|
cpu PC 0x8000
|
||||||
|
"""
|
||||||
|
|
||||||
|
logLevel 3
|
||||||
|
runMacro $reset
|
||||||
171
emulation/peripherals/BtEvents.cs
Normal file
171
emulation/peripherals/BtEvents.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010-2021 Antmicro
|
||||||
|
//
|
||||||
|
// This file is licensed under the MIT License.
|
||||||
|
// Full license text is available in 'licenses/MIT.txt'.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Antmicro.Renode.Core;
|
||||||
|
using Antmicro.Renode.Peripherals.Bus;
|
||||||
|
using Antmicro.Renode.Core.Structure.Registers;
|
||||||
|
using Antmicro.Renode.Logging;
|
||||||
|
|
||||||
|
namespace Antmicro.Renode.Peripherals.GPIOPort
|
||||||
|
{
|
||||||
|
public class BtEvents : BaseGPIOPort, IProvidesRegisterCollection<DoubleWordRegisterCollection>, IDoubleWordPeripheral, IKnownSize
|
||||||
|
{
|
||||||
|
public BtEvents(Machine machine) : base(machine, NumberOfPins)
|
||||||
|
{
|
||||||
|
IRQ = new GPIO();
|
||||||
|
Pins = new Pin[NumberOfPins];
|
||||||
|
for (var i = 0; i < Pins.Length; i++)
|
||||||
|
{
|
||||||
|
Pins[i] = new Pin(this, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegistersCollection = new DoubleWordRegisterCollection(this);
|
||||||
|
DefineRegisters();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
base.Reset();
|
||||||
|
|
||||||
|
RegistersCollection.Reset();
|
||||||
|
|
||||||
|
foreach (var pin in Pins)
|
||||||
|
{
|
||||||
|
pin.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
ComIntPending.Value = false;
|
||||||
|
RtcIntPending.Value = false;
|
||||||
|
ComIntEnable.Value = false;
|
||||||
|
RtcIntEnable.Value = false;
|
||||||
|
UpdateInterrupts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint ReadDoubleWord(long offset)
|
||||||
|
{
|
||||||
|
return RegistersCollection.Read(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteDoubleWord(long offset, uint value)
|
||||||
|
{
|
||||||
|
RegistersCollection.Write(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGPIO(int number, bool value)
|
||||||
|
{
|
||||||
|
// These interrupts fire on the rising edge
|
||||||
|
if (number == 0 && !Pins[number].Value && value) {
|
||||||
|
ComIntPending.Value = true;
|
||||||
|
}
|
||||||
|
if (number == 1 && !Pins[number].Value && value) {
|
||||||
|
RtcIntPending.Value = true;
|
||||||
|
}
|
||||||
|
base.OnGPIO(number, value);
|
||||||
|
if (CheckPinNumber(number))
|
||||||
|
{
|
||||||
|
PinChanged?.Invoke(Pins[number], value);
|
||||||
|
}
|
||||||
|
UpdateInterrupts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleWordRegisterCollection RegistersCollection { get; }
|
||||||
|
public Pin[] Pins { get; }
|
||||||
|
public GPIO IRQ { get; private set; }
|
||||||
|
|
||||||
|
public long Size => 0x1000;
|
||||||
|
|
||||||
|
public event Action<Pin, bool> PinChanged;
|
||||||
|
public event Action Detect;
|
||||||
|
|
||||||
|
private void DefineRegisters()
|
||||||
|
{
|
||||||
|
Registers.EvStatus.Define32(this)
|
||||||
|
.WithFlag(0, FieldMode.Read, valueProviderCallback: _ => Pins[0].Value, name: "com_int")
|
||||||
|
.WithFlag(1, FieldMode.Read, valueProviderCallback: _ => Pins[1].Value, name: "rtc_int")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.EvPending.Define32(this)
|
||||||
|
.WithFlag(0, out ComIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "com_int", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
.WithFlag(1, out RtcIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "rtc_int", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.EvEnable.Define32(this)
|
||||||
|
.WithFlag(0, out ComIntEnable, FieldMode.Read | FieldMode.Write, name: "com_int", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
.WithFlag(1, out RtcIntEnable, FieldMode.Read | FieldMode.Write, name: "rtc_int", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateInterrupts()
|
||||||
|
{
|
||||||
|
IRQ.Set((ComIntPending.Value && ComIntEnable.Value)
|
||||||
|
|| (RtcIntPending.Value && RtcIntEnable.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool detectState;
|
||||||
|
private IFlagRegisterField ComIntPending;
|
||||||
|
private IFlagRegisterField RtcIntPending;
|
||||||
|
private IFlagRegisterField ComIntEnable;
|
||||||
|
private IFlagRegisterField RtcIntEnable;
|
||||||
|
|
||||||
|
private const int NumberOfPins = 2;
|
||||||
|
|
||||||
|
public class Pin
|
||||||
|
{
|
||||||
|
public Pin(BtEvents parent, int id)
|
||||||
|
{
|
||||||
|
this.Parent = parent;
|
||||||
|
this.Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Parent.Connections[Id].Set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RawValue;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Parent.NoisyLog("Setting pin {0} to {1}", Id, value);
|
||||||
|
Parent.Connections[Id].Set(value);
|
||||||
|
Parent.State[Id] = value;
|
||||||
|
Parent.PinChanged(this, value);
|
||||||
|
Parent.UpdateInterrupts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This property is needed as the pull-up and pull-down should be
|
||||||
|
// able to override Pin state not matter Direction it is set to.
|
||||||
|
public bool RawValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Parent.State[Id];
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Parent.State[Id] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BtEvents Parent { get; }
|
||||||
|
public int Id { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum Registers
|
||||||
|
{
|
||||||
|
EvStatus = 0x00,
|
||||||
|
EvPending = 0x04,
|
||||||
|
EvEnable = 0x08,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -70,7 +70,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
{
|
{
|
||||||
this.holdGpio = gpio.Item2;
|
this.holdGpio = gpio.Item2;
|
||||||
}
|
}
|
||||||
if (gpio.Item1 == "INTERRUPT")
|
if (gpio.Item1 == "EC_INTERRUPT")
|
||||||
{
|
{
|
||||||
this.interruptGpio = gpio.Item2;
|
this.interruptGpio = gpio.Item2;
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +155,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
if (holdGpio != null)
|
if (holdGpio != null)
|
||||||
{
|
{
|
||||||
// controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld));
|
// controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld));
|
||||||
|
// this.Log(LogLevel.Warning, "Setting hold value to: {0}", value);
|
||||||
controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false);
|
controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +165,8 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
if (interruptGpio != null)
|
if (interruptGpio != null)
|
||||||
{
|
{
|
||||||
// controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld));
|
// controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, new TimeStamp(default(TimeInterval), EmulationManager.ExternalWorld));
|
||||||
controller.GetMachine().HandleTimeDomainEvent(holdGpio.Set, value, false);
|
// this.Log(LogLevel.Warning, "Setting interurpt value to: {0}", value);
|
||||||
|
controller.GetMachine().HandleTimeDomainEvent(interruptGpio.Set, value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
this.machine = machine;
|
this.machine = machine;
|
||||||
this.spi = spi;
|
this.spi = spi;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
// Hardware defaults to 1280 entries
|
// Hardware defaults to 1280 entries
|
||||||
readFifo = new ConcurrentQueue<uint>();
|
readFifo = new ConcurrentQueue<uint>();
|
||||||
writeFifo = new ConcurrentQueue<uint>();
|
writeFifo = new ConcurrentQueue<uint>();
|
||||||
|
|
@ -156,7 +157,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
{
|
{
|
||||||
TxValue = 0xDDDD;
|
TxValue = 0xDDDD;
|
||||||
}
|
}
|
||||||
this.Log(LogLevel.Noisy, "EC received:{0:X4} sent:{1:X4}", value, TxValue);
|
// this.Log(LogLevel.Noisy, "EC received:{0:X4} sent:{1:X4}", value, TxValue);
|
||||||
Hold.Set(!EcRam.WriteFifoHasData());
|
Hold.Set(!EcRam.WriteFifoHasData());
|
||||||
EcRam.WriteNextWord((ushort)value);
|
EcRam.WriteNextWord((ushort)value);
|
||||||
// this.Log(LogLevel.Info, "EcRam.ReadFifo now contains {0} items, EcRam.WriteFifo contains {1} items", EcRam.ReadFifoCount(), EcRam.WriteFifoCount());
|
// this.Log(LogLevel.Info, "EcRam.ReadFifo now contains {0} items, EcRam.WriteFifo contains {1} items", EcRam.ReadFifoCount(), EcRam.WriteFifoCount());
|
||||||
|
|
@ -177,6 +178,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
{
|
{
|
||||||
EcRam.Reset();
|
EcRam.Reset();
|
||||||
Hold.Set(true);
|
Hold.Set(true);
|
||||||
|
Interrupt.Set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long Size { get { return 0x100; } }
|
public long Size { get { return 0x100; } }
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,17 @@ using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace Antmicro.Renode.Peripherals.SPI
|
namespace Antmicro.Renode.Peripherals.SPI
|
||||||
{
|
{
|
||||||
public class BetrustedSocCom : NullRegistrationPointPeripheralContainer<IComController>, IDoubleWordPeripheral, IProvidesRegisterCollection<DoubleWordRegisterCollection>, IKnownSize
|
public class BetrustedSocCom : NullRegistrationPointPeripheralContainer<IComController>, IDoubleWordPeripheral,
|
||||||
|
IProvidesRegisterCollection<DoubleWordRegisterCollection>, IKnownSize, IGPIOReceiver
|
||||||
{
|
{
|
||||||
public BetrustedSocCom(Machine machine) : base(machine)
|
public BetrustedSocCom(Machine machine) : base(machine)
|
||||||
{
|
{
|
||||||
IRQ = new GPIO();
|
IRQ = new GPIO();
|
||||||
HOLD = new GPIO();
|
HOLD = new GPIO();
|
||||||
|
EC_INTERRUPT = new GPIO();
|
||||||
RegistersCollection = new DoubleWordRegisterCollection(this);
|
RegistersCollection = new DoubleWordRegisterCollection(this);
|
||||||
|
|
||||||
Registers.ComTx.Define32(this)
|
Registers.Tx.Define32(this)
|
||||||
.WithValueField(0, 16, FieldMode.Write, writeCallback: (_, val) =>
|
.WithValueField(0, 16, FieldMode.Write, writeCallback: (_, val) =>
|
||||||
{
|
{
|
||||||
// Skip transaction if HOLD is set
|
// Skip transaction if HOLD is set
|
||||||
|
|
@ -35,57 +37,67 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
// }
|
// }
|
||||||
Rx.Value = (uint)RegisteredPeripheral.Transmit((ushort)val);
|
Rx.Value = (uint)RegisteredPeripheral.Transmit((ushort)val);
|
||||||
RegisteredPeripheral.FinishTransmission();
|
RegisteredPeripheral.FinishTransmission();
|
||||||
machine.Log(LogLevel.Noisy, "SoC sent {0:X4} received {1:X4}", val, Rx.Value);
|
// machine.Log(LogLevel.Noisy, "SoC sent {0:X4} received {1:X4}", val, Rx.Value);
|
||||||
if (IntEna.Value)
|
|
||||||
{
|
|
||||||
SpiIntStatus.Value = true;
|
|
||||||
UpdateInterrupts();
|
|
||||||
SpiIntStatus.Value = false;
|
|
||||||
}
|
|
||||||
}, name: "TX")
|
}, name: "TX")
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.ComRx.Define32(this)
|
Registers.Rx.Define32(this)
|
||||||
.WithValueField(0, 16, out Rx, FieldMode.Read, name: "RX")
|
.WithValueField(0, 16, out Rx, FieldMode.Read, name: "RX")
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.ComControl.Define32(this)
|
Registers.Control.Define32(this)
|
||||||
.WithFlag(0, out IntEna, FieldMode.Read | FieldMode.Write, name: "IntEna")
|
.WithFlag(0, out IntEna, FieldMode.Read | FieldMode.Write, name: "IntEna")
|
||||||
.WithFlag(1, out AutoHold, FieldMode.Read | FieldMode.Write, name: "AutoHold")
|
.WithFlag(1, out AutoHold, FieldMode.Read | FieldMode.Write, name: "AutoHold")
|
||||||
;
|
;
|
||||||
Registers.ComStatus.Define32(this)
|
Registers.Status.Define32(this)
|
||||||
.WithFlag(0, out Tip, FieldMode.Read, name: "Tip")
|
.WithFlag(0, out Tip, FieldMode.Read, name: "Tip")
|
||||||
.WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "Hold")
|
.WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "Hold")
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.ComEvStatus.Define32(this)
|
Registers.EvStatus.Define32(this)
|
||||||
.WithFlag(0, out SpiIntStatus, FieldMode.Read, name: "SpiInt")
|
.WithFlag(0, FieldMode.Read, valueProviderCallback: _ => EC_INTERRUPT.IsSet, name: "SpiInt")
|
||||||
.WithFlag(1, FieldMode.Read, valueProviderCallback: (_) => HOLD.IsSet, name: "SpiHold")
|
.WithFlag(1, FieldMode.Read, valueProviderCallback: _ => HOLD.IsSet, name: "SpiHold")
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.ComEvPending.Define32(this)
|
Registers.EvPending.Define32(this)
|
||||||
.WithFlag(0, out SpiIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts())
|
.WithFlag(0, out SpiIntPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
.WithFlag(1, out SpiHoldPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts())
|
.WithFlag(1, out SpiHoldPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
;
|
;
|
||||||
|
|
||||||
Registers.ComEvEnable.Define32(this)
|
Registers.EvEnable.Define32(this)
|
||||||
.WithFlag(0, out SpiIntEnable, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts())
|
.WithFlag(0, out SpiIntEnable, FieldMode.Read | FieldMode.Write, name: "SpiInt", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
.WithFlag(1, out SpiHoldEnable, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts())
|
.WithFlag(1, out SpiHoldEnable, FieldMode.Read | FieldMode.Write, name: "SpiHold", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
HOLD.Connect(this, 0);
|
||||||
|
EC_INTERRUPT.Connect(this, 1);
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnGPIO(int number, bool value)
|
||||||
|
{
|
||||||
|
if (number == 1)
|
||||||
|
{
|
||||||
|
// this.Log(LogLevel.Error, "Setting IRQ GPIO to {0}", value ? "1" : "0");
|
||||||
|
EC_INTERRUPT.Set(value);
|
||||||
|
} else if (number == 0) {
|
||||||
|
// this.Log(LogLevel.Error, "Setting HOLD GPIO to {0}", value ? "1" : "0");
|
||||||
|
HOLD.Set(value);
|
||||||
|
}
|
||||||
|
UpdateInterrupts();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateInterrupts()
|
private void UpdateInterrupts()
|
||||||
{
|
{
|
||||||
// if (RegisteredPeripheral.Interrupt())
|
|
||||||
// {
|
|
||||||
// SpiIntPending.Value = true;
|
|
||||||
// }
|
|
||||||
if (HOLD.IsSet)
|
if (HOLD.IsSet)
|
||||||
{
|
{
|
||||||
SpiHoldPending.Value = true;
|
SpiHoldPending.Value = true;
|
||||||
}
|
}
|
||||||
|
if (EC_INTERRUPT.IsSet)
|
||||||
|
{
|
||||||
|
SpiIntPending.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
IRQ.Set((SpiIntPending.Value && SpiIntEnable.Value)
|
IRQ.Set((SpiIntPending.Value && SpiIntEnable.Value)
|
||||||
|| (SpiHoldPending.Value && SpiHoldEnable.Value));
|
|| (SpiHoldPending.Value && SpiHoldEnable.Value));
|
||||||
}
|
}
|
||||||
|
|
@ -102,18 +114,14 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
// IntEna.Value = false;
|
|
||||||
// AutoHold.Value = false;
|
|
||||||
// Tip.Value = false;
|
|
||||||
// Rx.Value = 0;
|
|
||||||
|
|
||||||
SpiIntStatus.Value = false;
|
|
||||||
SpiIntPending.Value = false;
|
SpiIntPending.Value = false;
|
||||||
SpiHoldPending.Value = false;
|
SpiHoldPending.Value = false;
|
||||||
SpiIntEnable.Value = false;
|
SpiIntEnable.Value = false;
|
||||||
SpiHoldEnable.Value = false;
|
SpiHoldEnable.Value = false;
|
||||||
|
|
||||||
Tip.Value = false;
|
Tip.Value = false;
|
||||||
|
EC_INTERRUPT.Set(false);
|
||||||
|
HOLD.Set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -121,6 +129,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
|
|
||||||
public GPIO IRQ { get; private set; }
|
public GPIO IRQ { get; private set; }
|
||||||
public GPIO HOLD { get; private set; }
|
public GPIO HOLD { get; private set; }
|
||||||
|
public GPIO EC_INTERRUPT { get; private set; }
|
||||||
|
|
||||||
private IFlagRegisterField IntEna;
|
private IFlagRegisterField IntEna;
|
||||||
private IFlagRegisterField AutoHold;
|
private IFlagRegisterField AutoHold;
|
||||||
|
|
@ -128,7 +137,6 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
private IValueRegisterField Rx;
|
private IValueRegisterField Rx;
|
||||||
|
|
||||||
// Interrupts
|
// Interrupts
|
||||||
private IFlagRegisterField SpiIntStatus;
|
|
||||||
private IFlagRegisterField SpiIntPending;
|
private IFlagRegisterField SpiIntPending;
|
||||||
private IFlagRegisterField SpiHoldPending;
|
private IFlagRegisterField SpiHoldPending;
|
||||||
private IFlagRegisterField SpiIntEnable;
|
private IFlagRegisterField SpiIntEnable;
|
||||||
|
|
@ -138,14 +146,13 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
|
|
||||||
private enum Registers
|
private enum Registers
|
||||||
{
|
{
|
||||||
ComTx = 0x00,
|
Tx = 0x00,
|
||||||
|
Rx = 0x04,
|
||||||
ComRx = 0x04,
|
Control = 0x08,
|
||||||
ComControl = 0x08,
|
Status = 0x0c,
|
||||||
ComStatus = 0x0c,
|
EvStatus = 0x10,
|
||||||
ComEvStatus = 0x10,
|
EvPending = 0x14,
|
||||||
ComEvPending = 0x14,
|
EvEnable = 0x18,
|
||||||
ComEvEnable = 0x18,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
164
emulation/peripherals/EcWifi.cs
Normal file
164
emulation/peripherals/EcWifi.cs
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010-2021 Antmicro
|
||||||
|
//
|
||||||
|
// This file is licensed under the MIT License.
|
||||||
|
// Full license text is available in 'licenses/MIT.txt'.
|
||||||
|
//
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Antmicro.Renode.Core;
|
||||||
|
using Antmicro.Renode.Core.Structure;
|
||||||
|
using Antmicro.Renode.Exceptions;
|
||||||
|
using Antmicro.Renode.Logging;
|
||||||
|
using Antmicro.Renode.Time;
|
||||||
|
using Antmicro.Renode.Utilities;
|
||||||
|
using Antmicro.Renode.Peripherals.Bus;
|
||||||
|
using Antmicro.Renode.Core.Structure.Registers;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
|
// This SPI block is optimized for the WF200 chip. It always transfers 16 bits
|
||||||
|
namespace Antmicro.Renode.Peripherals.SPI
|
||||||
|
{
|
||||||
|
public class EcWifi : NullRegistrationPointPeripheralContainer<ISPIPeripheral>, IDoubleWordPeripheral, IProvidesRegisterCollection<DoubleWordRegisterCollection>, IKnownSize
|
||||||
|
{
|
||||||
|
public EcWifi(Machine machine) : base(machine)
|
||||||
|
{
|
||||||
|
IRQ = new GPIO();
|
||||||
|
RegistersCollection = new DoubleWordRegisterCollection(this);
|
||||||
|
|
||||||
|
Registers.Tx.Define32(this)
|
||||||
|
.WithValueField(0, 16, out Tx, FieldMode.Write, writeCallback: (_, __) => TxFull.Value = true, name: "tx")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.Rx.Define32(this)
|
||||||
|
.WithValueField(0, 16, out Rx, FieldMode.Read, name: "rx")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.Cs.Define32(this)
|
||||||
|
.WithFlag(0, FieldMode.Write, writeCallback: (_, new_cs) =>
|
||||||
|
{
|
||||||
|
// If we transition low -> high, finish the transaction -- note that
|
||||||
|
// CS logic is inverted in this block (i.e. writing a 1 drives CS low)
|
||||||
|
if (!new_cs && cs)
|
||||||
|
{
|
||||||
|
if (RegisteredPeripheral != null)
|
||||||
|
{
|
||||||
|
RegisteredPeripheral.FinishTransmission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cs = new_cs;
|
||||||
|
}, name: "cs")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.Control.Define32(this)
|
||||||
|
.WithFlag(0, FieldMode.Read | FieldMode.Write, writeCallback: (_, go) =>
|
||||||
|
{
|
||||||
|
if (go)
|
||||||
|
{
|
||||||
|
if (RegisteredPeripheral == null)
|
||||||
|
{
|
||||||
|
this.Log(LogLevel.Error, "tried to transfer data with no wifi chip attached");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Rx.Value = ((uint)RegisteredPeripheral.Transmit((byte)(Tx.Value >> 0))) << 0;
|
||||||
|
Rx.Value |= ((uint)RegisteredPeripheral.Transmit((byte)(Tx.Value >> 8))) << 8;
|
||||||
|
TxFull.Value = false;
|
||||||
|
machine.Log(LogLevel.Noisy, "SoC sent {0:X04} received {1:X04}",
|
||||||
|
Tx.Value, Rx.Value);
|
||||||
|
}
|
||||||
|
}, name: "go")
|
||||||
|
;
|
||||||
|
Registers.Status.Define32(this)
|
||||||
|
.WithFlag(0, out Tip, FieldMode.Read, name: "tip")
|
||||||
|
.WithFlag(1, out TxFull, FieldMode.Read, name: "txfull")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.Wifi.Define32(this)
|
||||||
|
.WithFlag(0, FieldMode.Read | FieldMode.Write, writeCallback: (_, val) =>
|
||||||
|
{
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
}, name: "reset")
|
||||||
|
.WithFlag(1, out PaEnable, FieldMode.Read | FieldMode.Write, name: "pa_ena")
|
||||||
|
.WithFlag(2, FieldMode.Read | FieldMode.Write, name: "wakeup")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.EvStatus.Define32(this)
|
||||||
|
.WithFlag(0, out WirqStatus, FieldMode.Read, name: "wirq")
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.EvPending.Define32(this)
|
||||||
|
.WithFlag(0, out WirqPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "wirq", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
;
|
||||||
|
|
||||||
|
Registers.EvEnable.Define32(this)
|
||||||
|
.WithFlag(0, out WirqEnable, name: "wirq", changeCallback: (_, __) => UpdateInterrupts())
|
||||||
|
;
|
||||||
|
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateInterrupts()
|
||||||
|
{
|
||||||
|
if (IRQ.IsSet)
|
||||||
|
{
|
||||||
|
WirqPending.Value = true;
|
||||||
|
}
|
||||||
|
IRQ.Set((WirqPending.Value && WirqEnable.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteDoubleWord(long address, uint value)
|
||||||
|
{
|
||||||
|
RegistersCollection.Write(address, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint ReadDoubleWord(long offset)
|
||||||
|
{
|
||||||
|
return RegistersCollection.Read(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
WirqStatus.Value = false;
|
||||||
|
WirqPending.Value = false;
|
||||||
|
WirqEnable.Value = false;
|
||||||
|
|
||||||
|
cs = false;
|
||||||
|
PaEnable.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long Size { get { return 0x100; } }
|
||||||
|
|
||||||
|
public GPIO IRQ { get; private set; }
|
||||||
|
|
||||||
|
private IFlagRegisterField PaEnable;
|
||||||
|
private bool cs;
|
||||||
|
private IValueRegisterField Tx;
|
||||||
|
private IValueRegisterField Rx;
|
||||||
|
private IFlagRegisterField TxFull;
|
||||||
|
private IFlagRegisterField Tip;
|
||||||
|
|
||||||
|
// Interrupts
|
||||||
|
private IFlagRegisterField WirqStatus;
|
||||||
|
private IFlagRegisterField WirqPending;
|
||||||
|
private IFlagRegisterField WirqEnable;
|
||||||
|
|
||||||
|
public DoubleWordRegisterCollection RegistersCollection { get; private set; }
|
||||||
|
|
||||||
|
private enum Registers
|
||||||
|
{
|
||||||
|
Tx = 0x00,
|
||||||
|
|
||||||
|
Rx = 0x04,
|
||||||
|
Cs = 0x08,
|
||||||
|
Control = 0x0c,
|
||||||
|
Status = 0x10,
|
||||||
|
Wifi = 0x14,
|
||||||
|
EvStatus = 0x18,
|
||||||
|
EvPending = 0x1c,
|
||||||
|
EvEnable = 0x20,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
|
|
||||||
public byte Transmit(byte data)
|
public byte Transmit(byte data)
|
||||||
{
|
{
|
||||||
this.Log(LogLevel.Noisy, "Received data 0x{0:X}, current state: {1} OPI mode? {2}", data, currentOperation.State, opiMode);
|
// this.Log(LogLevel.Noisy, "Received data 0x{0:X}, current state: {1} OPI mode? {2}", data, currentOperation.State, opiMode);
|
||||||
// Eat the first byte when running in OPI mode. The second byte should be the inverse of the first byte.
|
// Eat the first byte when running in OPI mode. The second byte should be the inverse of the first byte.
|
||||||
if (opiMode)
|
if (opiMode)
|
||||||
{
|
{
|
||||||
|
|
@ -145,7 +145,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
{
|
{
|
||||||
if (currentOperation.TryAccumulateAddress(addressByte))
|
if (currentOperation.TryAccumulateAddress(addressByte))
|
||||||
{
|
{
|
||||||
this.Log(LogLevel.Noisy, "Address accumulated: 0x{0:X}", currentOperation.ExecutionAddress);
|
// this.Log(LogLevel.Noisy, "Address accumulated: 0x{0:X}", currentOperation.ExecutionAddress);
|
||||||
currentOperation.State = nextState;
|
currentOperation.State = nextState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -181,12 +181,12 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes;
|
currentOperation.State = DecodedOperation.OperationState.AccumulateCommandAddressBytes;
|
||||||
break;
|
break;
|
||||||
case (byte)Commands.WriteEnable:
|
case (byte)Commands.WriteEnable:
|
||||||
this.Log(LogLevel.Noisy, "Setting write enable latch");
|
// this.Log(LogLevel.Noisy, "Setting write enable latch");
|
||||||
currentOperation.Operation = DecodedOperation.OperationType.None;
|
currentOperation.Operation = DecodedOperation.OperationType.None;
|
||||||
enable.Value = true;
|
enable.Value = true;
|
||||||
return; //return to prevent further logging
|
return; //return to prevent further logging
|
||||||
case (byte)Commands.WriteDisable:
|
case (byte)Commands.WriteDisable:
|
||||||
this.Log(LogLevel.Noisy, "Unsetting write enable latch");
|
// this.Log(LogLevel.Noisy, "Unsetting write enable latch");
|
||||||
currentOperation.Operation = DecodedOperation.OperationType.None;
|
currentOperation.Operation = DecodedOperation.OperationType.None;
|
||||||
enable.Value = false;
|
enable.Value = false;
|
||||||
return; //return to prevent further logging
|
return; //return to prevent further logging
|
||||||
|
|
@ -252,7 +252,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
this.Log(LogLevel.Error, "Command decoding failed on byte: 0x{0:X} ({1}).", firstByte, (Commands)firstByte);
|
this.Log(LogLevel.Error, "Command decoding failed on byte: 0x{0:X} ({1}).", firstByte, (Commands)firstByte);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.Log(LogLevel.Noisy, "Decoded operation: {0}, write enabled {1}", currentOperation, enable.Value);
|
// this.Log(LogLevel.Noisy, "Decoded operation: {0}, write enabled {1}", currentOperation, enable.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte HandleCommand(byte data)
|
private byte HandleCommand(byte data)
|
||||||
|
|
@ -304,7 +304,7 @@ namespace Antmicro.Renode.Peripherals.SPI
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentOperation.CommandBytesHandled++;
|
currentOperation.CommandBytesHandled++;
|
||||||
this.Log(LogLevel.Noisy, "Handled command: {0}, returning 0x{1:X}", currentOperation, result);
|
// this.Log(LogLevel.Noisy, "Handled command: {0}, returning 0x{1:X}", currentOperation, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1212
emulation/peripherals/WF200.cs
Normal file
1212
emulation/peripherals/WF200.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -73,12 +73,16 @@ namespace Antmicro.Renode.Peripherals.CPU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Log(LogLevel.Noisy, "PC@0x{8:X}: Handling aes instruction: is dec? {0}, is last? {1}, rs1: x{2} ({5:X8}), rs2: x{3} ({6:X8}), written to x{4} ({7:X8})",
|
// this.Log(LogLevel.Noisy, "PC@0x{8:X}: Handling aes instruction: is dec? {0}, is last? {1}, rs1: x{2} ({5:X8}), rs2: x{3} ({6:X8}), written to x{4} ({7:X8})",
|
||||||
is_dec, is_last, rs1, rs2, rd, arg1, arg2, result, PC.RawValue);
|
// is_dec, is_last, rs1, rs2, rd, arg1, arg2, result, PC.RawValue);
|
||||||
|
|
||||||
SetRegisterUnsafe(rd, (ulong)result);
|
SetRegisterUnsafe(rd, (ulong)result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the AES tables.
|
||||||
|
// This is a very odd format for C# code because the obvious method of including it in
|
||||||
|
// the initializers doesn't appear to work with the dynamically-loaded module system
|
||||||
|
// used in Renode.
|
||||||
private void CreateTables()
|
private void CreateTables()
|
||||||
{
|
{
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,14 @@ memlcd: Video.BetrustedLCD @ sysbus 0xf000c000
|
||||||
memSize: 0x5c20
|
memSize: 0x5c20
|
||||||
|
|
||||||
com: SPI.BetrustedSocCom @ sysbus 0xf000d000
|
com: SPI.BetrustedSocCom @ sysbus 0xf000d000
|
||||||
|
EC_INTERRUPT -> btevents @ 0
|
||||||
IRQ -> cpu @ 1005
|
IRQ -> cpu @ 1005
|
||||||
|
|
||||||
i2c: I2C.BetrustedSocI2C @ sysbus 0xf000e000
|
i2c: I2C.BetrustedSocI2C @ sysbus 0xf000e000
|
||||||
IRQ -> cpu @ 1006
|
IRQ -> cpu @ 1006
|
||||||
|
|
||||||
// Unrecognized peripheral: btevents @ 0xf000f000
|
btevents: GPIOPort.BtEvents @ sysbus 0xf000f000
|
||||||
|
IRQ -> cpu @ 1007
|
||||||
|
|
||||||
// Unrecognized peripheral: messible @ 0xf0010000
|
// Unrecognized peripheral: messible @ 0xf0010000
|
||||||
|
|
||||||
|
|
|
||||||
BIN
emulation/versatile-vmlinux
Normal file
BIN
emulation/versatile-vmlinux
Normal file
Binary file not shown.
|
|
@ -1,5 +1,7 @@
|
||||||
# Boot Renode Script (boot.resc)
|
# Boot Renode Script (boot.resc)
|
||||||
|
|
||||||
|
i @emulation/linux-server.resc
|
||||||
|
|
||||||
# Add this script's path to the global path, so
|
# Add this script's path to the global path, so
|
||||||
# we can include files relative to ourselves.
|
# we can include files relative to ourselves.
|
||||||
path add $ORIGIN
|
path add $ORIGIN
|
||||||
|
|
@ -15,13 +17,14 @@ i @peripherals/BetrustedSpinor.cs
|
||||||
i @peripherals/BetrustedWatchdog.cs
|
i @peripherals/BetrustedWatchdog.cs
|
||||||
i @peripherals/BQ24157.cs
|
i @peripherals/BQ24157.cs
|
||||||
i @peripherals/BQ27421.cs
|
i @peripherals/BQ27421.cs
|
||||||
|
i @peripherals/BtEvents.cs
|
||||||
i @peripherals/ComConnector.cs
|
i @peripherals/ComConnector.cs
|
||||||
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComPeripheral"
|
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComPeripheral"
|
||||||
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComController"
|
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.SPI.IComController"
|
||||||
i @peripherals/ComSoC.cs
|
|
||||||
i @peripherals/ComEc.cs
|
i @peripherals/ComEc.cs
|
||||||
i @peripherals/ComSoC.cs
|
i @peripherals/ComSoC.cs
|
||||||
i @peripherals/ec_power.cs
|
i @peripherals/ec_power.cs
|
||||||
|
i @peripherals/EcWifi.cs
|
||||||
i @peripherals/engine.cs
|
i @peripherals/engine.cs
|
||||||
i @peripherals/keyboard.cs
|
i @peripherals/keyboard.cs
|
||||||
i @peripherals/keyrom.cs
|
i @peripherals/keyrom.cs
|
||||||
|
|
@ -36,6 +39,7 @@ i @peripherals/ticktimer.cs
|
||||||
i @peripherals/trng_kernel.cs
|
i @peripherals/trng_kernel.cs
|
||||||
i @peripherals/trng_server.cs
|
i @peripherals/trng_server.cs
|
||||||
i @peripherals/TUSB320LAI.cs
|
i @peripherals/TUSB320LAI.cs
|
||||||
|
i @peripherals/WF200.cs
|
||||||
i @peripherals/wfi.cs
|
i @peripherals/wfi.cs
|
||||||
|
|
||||||
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.VexRiscv"
|
EnsureTypeIsLoaded "Antmicro.Renode.Peripherals.CPU.VexRiscv"
|
||||||
|
|
@ -84,6 +88,7 @@ connector Connect sysbus.com com
|
||||||
# The macro `reset` gets called implicitly when running `machine Reset`
|
# The macro `reset` gets called implicitly when running `machine Reset`
|
||||||
macro reset
|
macro reset
|
||||||
"""
|
"""
|
||||||
|
#sysbus LoadBinary @flash-formatted.bin 0x20000000
|
||||||
sysbus LoadELF @../loader/target/riscv32imac-unknown-xous-elf/release/loader
|
sysbus LoadELF @../loader/target/riscv32imac-unknown-xous-elf/release/loader
|
||||||
sysbus LoadBinary @../target/riscv32imac-unknown-xous-elf/release/xous.img 0x20980000
|
sysbus LoadBinary @../target/riscv32imac-unknown-xous-elf/release/xous.img 0x20980000
|
||||||
# Set $a0 to point at the args binary
|
# Set $a0 to point at the args binary
|
||||||
|
|
@ -91,8 +96,7 @@ macro reset
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Connect the serial port to an Ethernet port
|
# Connect the serial port to an Ethernet port
|
||||||
mach set 0
|
emulation CreateServerSocketTerminal 8888 "kernel" False
|
||||||
emulation CreateServerSocketTerminal 9999 "kernel" False
|
|
||||||
connector Connect sysbus.uart kernel
|
connector Connect sysbus.uart kernel
|
||||||
|
|
||||||
runMacro $reset
|
runMacro $reset
|
||||||
|
|
@ -105,6 +109,9 @@ machine LoadPlatformDescription @ec/betrusted-ec.repl
|
||||||
|
|
||||||
# logLevel -1 i2c
|
# logLevel -1 i2c
|
||||||
# logLevel -1 i2c.bq27421
|
# logLevel -1 i2c.bq27421
|
||||||
|
# logLevel -1 wifi
|
||||||
|
logLevel 0 wifi.wf200
|
||||||
|
# sysbus LogPeripheralAccess wifi true
|
||||||
|
|
||||||
machine StartGdbServer 3334 true
|
machine StartGdbServer 3334 true
|
||||||
showAnalyzer uart
|
showAnalyzer uart
|
||||||
|
|
@ -115,12 +122,16 @@ connector Connect sysbus.com com
|
||||||
macro reset
|
macro reset
|
||||||
"""
|
"""
|
||||||
sysbus LoadBinary @ec/bt-ec.bin 0x20000000
|
sysbus LoadBinary @ec/bt-ec.bin 0x20000000
|
||||||
|
sysbus LoadBinary @ec/wf200_fw.bin 0x2009C000
|
||||||
sysbus LoadBinary @ec/loader.bin 0x00000000
|
sysbus LoadBinary @ec/loader.bin 0x00000000
|
||||||
cpu PC 0
|
cpu PC 0
|
||||||
cpu SP 0x1001FFFC
|
cpu SP 0x1001FFFC
|
||||||
"""
|
"""
|
||||||
runMacro $reset
|
runMacro $reset
|
||||||
|
|
||||||
|
connector Connect wifi.wf200 switch
|
||||||
|
|
||||||
|
|
||||||
mach clear
|
mach clear
|
||||||
|
|
||||||
start
|
start
|
||||||
|
|
|
||||||
|
|
@ -577,6 +577,8 @@ fn print_peripherals<U: Write>(
|
||||||
if !freq_found {
|
if !freq_found {
|
||||||
panic!("Couldn't discover clock frequency when creating timer0 object");
|
panic!("Couldn't discover clock frequency when creating timer0 object");
|
||||||
}
|
}
|
||||||
|
} else if lc_name == "com" {
|
||||||
|
writeln!(out, " EC_INTERRUPT -> btevents @ 0")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a corresponding memory region, add it as parameters.
|
// If there is a corresponding memory region, add it as parameters.
|
||||||
|
|
@ -595,7 +597,11 @@ fn print_peripherals<U: Write>(
|
||||||
writeln!(out, " IRQ -> cpu @ {}", 1000 + irq.value)?;
|
writeln!(out, " IRQ -> cpu @ {}", 1000 + irq.value)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
writeln!(out, "// Unrecognized peripheral: {} @ 0x{:08x}", lc_name, peripheral.base)?;
|
writeln!(
|
||||||
|
out,
|
||||||
|
"// Unrecognized peripheral: {} @ 0x{:08x}",
|
||||||
|
lc_name, peripheral.base
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
writeln!(out)?;
|
writeln!(out)?;
|
||||||
}
|
}
|
||||||
|
|
@ -635,6 +641,7 @@ pub fn generate<T: Read, U: Write>(src: T, dest: &mut U) -> Result<(), ParseErro
|
||||||
let mut cs_peripherals = HashMap::new();
|
let mut cs_peripherals = HashMap::new();
|
||||||
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("btevents", "GPIOPort.BtEvents");
|
||||||
cs_peripherals.insert("engine", "Miscellaneous.Engine");
|
cs_peripherals.insert("engine", "Miscellaneous.Engine");
|
||||||
cs_peripherals.insert("com", "SPI.BetrustedSocCom");
|
cs_peripherals.insert("com", "SPI.BetrustedSocCom");
|
||||||
cs_peripherals.insert("i2c", "I2C.BetrustedSocI2C");
|
cs_peripherals.insert("i2c", "I2C.BetrustedSocI2C");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue