Skip to content

Commit

Permalink
i3c: Start basic driver
Browse files Browse the repository at this point in the history
This does the initialization sequence, routes interrupts, and does
passes reads and writes to the clients.

I haven't had a chance to do much testing yet, but that will be easier
once the peripheral is more complete.
  • Loading branch information
swenson committed Nov 22, 2024
1 parent 2e505ec commit 82f07d5
Show file tree
Hide file tree
Showing 10 changed files with 619 additions and 10 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
[workspace]
members = [
"emulator/app",
"emulator/bmc/pldm-fw-pkg",
"emulator/bus",
"emulator/caliptra",
"emulator/compliance-test",
"emulator/bus",
"emulator/cpu",
"emulator/derive",
"emulator/periph",
"emulator/types",
"registers/generated-emulator",
"registers/generated-firmware",
"registers/generator",
"registers/systemrdl",
"rom",
"runtime",
"runtime/apps/pldm",
"runtime/i3c",
"tests/hello",
"xtask",
"registers/generated-emulator",
"registers/generated-firmware",
"registers/generator",
"registers/systemrdl",
"emulator/bmc/pldm-fw-pkg",
]
resolver = "2"

Expand Down Expand Up @@ -61,6 +62,7 @@ gdbstub = "0.6.3"
gdbstub_arch = "0.2.4"
getrandom = "0.2"
hex = "0.4.3"
i3c-driver = { path = "runtime/i3c" }
lazy_static = "1.4.0"
num-derive = "0.4.2"
num_enum = "0.7.2"
Expand Down
9 changes: 8 additions & 1 deletion emulator/periph/src/i3c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use emulator_bus::{Clock, Timer};
use emulator_cpu::Irq;
use emulator_registers_generated::i3c::I3cPeripheral;
use emulator_types::{RvData, RvSize};
use registers_generated::i3c::bits::{ExtcapHeader, TtiQueueSize};
use registers_generated::i3c::bits::{ExtcapHeader, StbyCrCapabilities, TtiQueueSize};
use std::collections::VecDeque;
use zerocopy::FromBytes;

Expand Down Expand Up @@ -97,6 +97,13 @@ impl I3cPeripheral for I3c {
RvData::from(Self::HCI_VERSION)
}

fn read_i3c_ec_stdby_ctrl_mode_stby_cr_capabilities(
&mut self,
_size: emulator_types::RvSize,
) -> emulator_bus::ReadWriteRegister<u32, StbyCrCapabilities::Register> {
emulator_bus::ReadWriteRegister::new(StbyCrCapabilities::TargetXactSupport.val(1).value)
}

fn read_i3c_ec_tti_extcap_header(
&mut self,
_size: RvSize,
Expand Down
3 changes: 3 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ capsules-core = { git = "https://github.com/tock/tock.git", rev = "b128ae817b867
capsules-extra = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
capsules-system = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
components = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
registers-generated.workspace = true
riscv = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
riscv-csr = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
rv32i = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
tock-registers.workspace = true
15 changes: 15 additions & 0 deletions runtime/i3c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Licensed under the Apache-2.0 license

[package]
name = "i3c-driver"
version.workspace = true
authors.workspace = true
edition.workspace = true

[dependencies]
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }

[target.'cfg(target_arch = "riscv32")'.dependencies]
capsules-core = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
registers-generated.workspace = true
tock-registers.workspace = true
Loading

0 comments on commit 82f07d5

Please sign in to comment.