Skip to content

Commit

Permalink
add MFR_SPECIAL_OPTIONS to bmr491
Browse files Browse the repository at this point in the history
  • Loading branch information
bcantrill committed Apr 25, 2024
1 parent c7e916c commit 7887cbe
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pmbus"
version = "0.1.2"
version = "0.1.3"
authors = ["Bryan Cantrill <[email protected]>"]
edition = "2018"
license = "MPL-2.0"
Expand Down
8 changes: 3 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ struct Factor(f32);
#[derive(Clone, Debug, Deserialize)]
struct Base(i8);

#[derive(Debug, Deserialize)]
struct Offset(f32);

#[derive(Debug, Deserialize)]
struct Value(u16, String);

Expand Down Expand Up @@ -118,6 +115,7 @@ enum Format {
SLimear16,
Direct(Coefficients),
RuntimeDirect,
#[allow(unused)]
VOutMode(Sign),
FixedPoint(Factor),
SignedFixedPoint(Factor),
Expand Down Expand Up @@ -2430,10 +2428,10 @@ fn codegen() -> Result<()> {
output_aux_numerics(&aux.numerics, &sizes, &mut units, coeff)?;
file.write_all(out.as_bytes())?;

let mut aux_structured_sorted: Vec<_> = aux.structured.iter().collect();
let mut aux_structured_sorted: Vec<_> =
aux.structured.iter().collect();
aux_structured_sorted.sort_by(|a, b| a.0.cmp(b.0));


for (aux, fields) in &aux_structured_sorted {
let (bits, bytes) = validate(aux, fields, &sizes, &mut units)?;

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.57"
channel = "nightly-2024-04-04"
51 changes: 51 additions & 0 deletions src/bmr491.ron
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,57 @@
// This factor is likely wrong, but unclear what it should be
values: FixedPointUnits(Factor(1), Volts)
)
},

"MFR_SPECIAL_OPTIONS": {
"RequirePEC": (
name: "Require Packet Error Check",
bits: Bit(7),
values: Sentinels({
"Disabled": (0b0, "disabled"),
"Enabled": (0b1, "enabled"),
}),
),
"EnableHRR": (
name: "Enable hybrid regulated ratio",
bits: Bit(6),
values: Sentinels({
"Disabled": (0b0, "disabled"),
"Enabled": (0b1, "enabled"),
}),
),
"DLSSlopeConfiguration": (
name: "Vout droop slope configuration",
bits: Bit(5),
values: Sentinels({
"Linear": (0b0, "linear droop"),
"NonLinear": (0b1, "non-linear droop"),
}),
),
"TelemetryMode": (
name: "Telemetry mode",
bits: Bit(4),
values: Sentinels({
"Converted": (0b0, "converted to units"),
"Raw": (0b1, "raw ADC output"),
}),
),
"EnableARTDLC": (
name: "Enable adaptive ramp-up time/dynamic load compensation",
bits: Bit(3),
values: Sentinels({
"Disabled": (0b0, "disabled"),
"Enabled": (0b1, "enabled"),
}),
),
"EnableDBV": (
name: "Enable dynamic bus voltage",
bits: Bit(2),
values: Sentinels({
"Disabled": (0b0, "disabled"),
"Enabled": (0b1, "enabled"),
}),
)
}
},

Expand Down
4 changes: 2 additions & 2 deletions src/renesas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ impl Blackbox {
/// value to sent to the `DMAADDR` command, where [`Address`] represents an
/// absolute address.
///
pub struct Address(u32);
pub struct DMAAddress(u16);
pub struct Address(pub u32);
pub struct DMAAddress(pub u16);

/// The configuration ID, as WW.XX.YY.ZZ
pub const DMAADDR_CONFIG_ID: DMAAddress = DMAAddress(0x00c1);
Expand Down

0 comments on commit 7887cbe

Please sign in to comment.