Skip to content

Commit

Permalink
Merge branch 'main' into eliza/simplify-plic
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw authored Apr 10, 2024
2 parents 8612b76 + a12e31f commit 03d1734
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 98 deletions.
40 changes: 19 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ jobs:
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: install rust toolchain
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- name: add wasm target
run: rustup target add wasm32-unknown-unknown
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
- name: run just check
run: just check
Expand All @@ -59,12 +57,10 @@ jobs:
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: install rust toolchain
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- name: add wasm target
run: rustup target add wasm32-unknown-unknown
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
- name: run just clippy
run: just clippy
Expand All @@ -78,10 +74,10 @@ jobs:
runs-on: ubuntu-latest
needs: check
steps:
- name: install rust toolchain
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: actions/checkout@v2
# note that this actually *needs* to be `--release`, because the D1 platform
# impl apparently just Does Not Build in debug mode (debug builds fail with
# a pile of linker errors, what the heck...)
Expand All @@ -99,34 +95,36 @@ jobs:
run: |
sudo apt-get update \
&& sudo apt-get install -y libudev-dev libsdl2-dev
- name: install rust toolchain
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
- name: just test
run: just test

# (test-host forth3) - run miri tests
test-host-miri:
runs-on: ubuntu-latest
name: cargo miri test (host)
name: cargo miri test --package forth3 (host)
needs: check
# TODO(eliza): only run this if forth3 changed?
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
steps:
- name: install rust toolchain and miri
run: |
rustup toolchain install nightly --component miri
cargo +nightly miri setup
- uses: actions/checkout@v3
- name: rust toolchain
run: rustup show
- name: install Miri
run: |
rustup component add miri
cargo miri setup
- name: cargo miri test (forth3)
run: |
cargo +nightly miri test \
cargo miri test \
--package forth3 \
--all-features
Expand All @@ -136,9 +134,9 @@ jobs:
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install rust toolchain
run: rustup show
- uses: actions/checkout@v2
- name: run rustfmt
run: cargo fmt --check

Expand All @@ -152,9 +150,9 @@ jobs:
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: install rust toolchain
run: rustup show
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: extractions/setup-just@v1
- name: run rustdoc
Expand Down
71 changes: 49 additions & 22 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ debug = "line-tables-only"

[patch.crates-io.maitake]
git = "https://github.com/hawkw/mycelium.git"
rev = "101a4abaa19afdd131b334a16d92c9fb4909c064"
rev = "13d0722429ef201f38e4ea47ea22d88f3f72c10e"

[patch.crates-io.mycelium-util]
git = "https://github.com/hawkw/mycelium.git"
rev = "101a4abaa19afdd131b334a16d92c9fb4909c064"
rev = "13d0722429ef201f38e4ea47ea22d88f3f72c10e"

# Use the `mycelium-bitfield` crate from the Mycelium monorepo rather than
# crates.io.
Expand All @@ -158,11 +158,11 @@ rev = "101a4abaa19afdd131b334a16d92c9fb4909c064"
# having both a Git dep and a crates.io dep seems unfortunate.
[patch.crates-io.mycelium-bitfield]
git = "https://github.com/hawkw/mycelium.git"
rev = "101a4abaa19afdd131b334a16d92c9fb4909c064"
rev = "13d0722429ef201f38e4ea47ea22d88f3f72c10e"

[patch.crates-io.cordyceps]
git = "https://github.com/hawkw/mycelium.git"
rev = "101a4abaa19afdd131b334a16d92c9fb4909c064"
rev = "13d0722429ef201f38e4ea47ea22d88f3f72c10e"

[patch.crates-io.bbq10kbd]
git = "https://github.com/hawkw/bbq10kbd"
Expand All @@ -180,4 +180,4 @@ rev = "5a8be302b4049a6ebc17bd712d97c85a9fd83f76"

[patch.crates-io.esp-hal-procmacros]
git = "https://github.com/esp-rs/esp-hal"
rev = "5a8be302b4049a6ebc17bd712d97c85a9fd83f76"
rev = "5a8be302b4049a6ebc17bd712d97c85a9fd83f76"
4 changes: 2 additions & 2 deletions platforms/allwinner-d1/d1-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sharp-display = []
[dependencies]
serde = { version = "1.0.178", features = ["derive"], default-features = false }
mnemos-bitslab = { path = "../../../source/bitslab" }
mycelium-bitfield = "0.1.3"
mycelium-bitfield = "0.1.5"

d1-pac = "0.0.31"
critical-section = "1.1.1"
Expand Down Expand Up @@ -46,4 +46,4 @@ default-features = false

[dev-dependencies]
proptest = "1"
proptest-derive = "0.4.0"
proptest-derive = "0.4.0"
47 changes: 2 additions & 45 deletions platforms/allwinner-d1/d1-core/src/drivers/twi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,52 +679,9 @@ impl TwiData {

unsafe impl Sync for IsrData {}

// TODO(eliza): this ought to go in `mycelium-bitfield` eventually
macro_rules! enum_try_from {
(
$(#[$meta:meta])* $vis:vis enum $name:ident<$repr:ty> {
$(
$(#[$var_meta:meta])*
$variant:ident = $value:expr
),* $(,)?
}
) => {
$(#[$meta])*
#[repr($repr)]
$vis enum $name {
$(
$(#[$var_meta])*
$variant = $value
),*
}


impl core::convert::TryFrom<$repr> for $name {
type Error = &'static str;

fn try_from(value: $repr) -> Result<Self, Self::Error> {
match value {
$(
$value => Ok(Self::$variant),
)*
_ => Err(concat!(
"invalid value for ",
stringify!($name),
": expected one of [",
$(
stringify!($value),
", ",
)* "]")
),
}
}
}
};
}

enum_try_from! {
mycelium_bitfield::enum_from_bits! {
/// Values of the `TWI_STAT` register.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq)]
enum Status<u8> {
/// 0x00: Bus error
BusError = 0x00,
Expand Down
2 changes: 1 addition & 1 deletion platforms/beepy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ features = ["async-await"]
default-features = false

[dependencies.mycelium-bitfield]
version = "0.1.2"
version = "0.1.5"
Loading

0 comments on commit 03d1734

Please sign in to comment.