Skip to content

Commit

Permalink
gimlet-seq: count I2C error codes (#1630)
Browse files Browse the repository at this point in the history
This commit adds `#[count(children)]` to the `Trace::I2cFault` variant
in `gimlet-seq`.
  • Loading branch information
hawkw committed Feb 28, 2024
1 parent 3d5f7b0 commit 0c29f28
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions drv/gimlet-seq-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ enum Trace {
SpdDimmsFound(usize),
I2cFault {
retries_remaining: u8,
#[count(children)]
code: i2c::ResponseCode,
},
StartFailed(#[count(children)] SeqError),
Expand Down
4 changes: 4 additions & 0 deletions drv/i2c-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ serde.workspace = true
enum-kinds.workspace = true

derive-idol-err.path = "../../lib/derive-idol-err"
counters.path = "../../lib/counters"

[build-dependencies]
build-util.path = "../../build/util"
9 changes: 9 additions & 0 deletions drv/i2c-types/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

fn main() {
if let Err(e) = build_util::expose_m_profile() {
println!("cargo:warning={e}");
}
}
3 changes: 2 additions & 1 deletion drv/i2c-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ pub enum Op {
Serialize,
Deserialize,
SerializedSize,
counters::Count,
)]
#[enum_kind(ResponseCodeU8)]
#[enum_kind(ResponseCodeU8, derive(counters::Count))]
#[repr(u32)]
pub enum ResponseCode {
/// Bad response from server
Expand Down
2 changes: 1 addition & 1 deletion lib/counters/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<'input> CountGenerator<'input> {
};

fn count(&self, counters: &Self::Counters) {
#[cfg(armv6m)]
#[cfg(all(target_arch = "arm", armv6m))]
use counters::armv6m_atomic_hack::AtomicU32Ext;

match self {
Expand Down

0 comments on commit 0c29f28

Please sign in to comment.