Skip to content

Commit

Permalink
i2c_driver should use a counted ringbuf (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcantrill committed Mar 15, 2024
1 parent 97a635f commit ff97115
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
35 changes: 31 additions & 4 deletions drv/stm32xx-i2c-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,37 @@ build-util = { path = "../../build/util" }
build-i2c = { path = "../../build/i2c" }

[features]
h743 = ["stm32h7/stm32h743", "drv-stm32xx-i2c/h743", "drv-stm32xx-sys-api/h743", "build-i2c/h743", "panic-messages"]
h753 = ["stm32h7/stm32h753", "drv-stm32xx-i2c/h753", "drv-stm32xx-sys-api/h753", "build-i2c/h753", "panic-messages"]
g031 = ["stm32g0/stm32g031", "drv-stm32xx-i2c/g031", "drv-stm32xx-sys-api/g031", "build-i2c/g031", "ringbuf/disabled", "panic-messages"]
g030 = ["stm32g0/stm32g030", "drv-stm32xx-i2c/g030", "drv-stm32xx-sys-api/g030", "build-i2c/g030", "ringbuf/disabled"]
h743 = [
"stm32h7/stm32h743",
"drv-stm32xx-i2c/h743",
"drv-stm32xx-sys-api/h743",
"build-i2c/h743",
"panic-messages",
]
h753 = [
"stm32h7/stm32h753",
"drv-stm32xx-i2c/h753",
"drv-stm32xx-sys-api/h753",
"build-i2c/h753",
"panic-messages",
]
g031 = [
"stm32g0/stm32g031",
"drv-stm32xx-i2c/g031",
"drv-stm32xx-sys-api/g031",
"build-i2c/g031",
"ringbuf-disabled",
"panic-messages",
]
g030 = [
"stm32g0/stm32g030",
"drv-stm32xx-i2c/g030",
"drv-stm32xx-sys-api/g030",
"build-i2c/g030",
"ringbuf-disabled",
]

ringbuf-disabled = ["ringbuf/disabled", "ringbuf/counters-disabled"]
panic-messages = ["userlib/panic-messages"]
no-ipc-counters = ["idol/no-counters"]

Expand Down
4 changes: 2 additions & 2 deletions drv/stm32xx-i2c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ enum Trace {
WaitTx,
BusySleep,
Stop,
RepeatedStart(bool),
RepeatedStart(#[count(children)] bool),
LostInterrupt,
Panic(Register, u32),
#[count(skip)]
None,
}

ringbuf!(Trace, 48, Trace::None);
counted_ringbuf!(Trace, 48, Trace::None);

impl I2cMux<'_> {
/// A convenience routine to translate an error induced by in-band
Expand Down

0 comments on commit ff97115

Please sign in to comment.