Skip to content

Commit 8c5ce06

Browse files
committed
--pd-info: Print which ports are enabled
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 64381fc commit 8c5ce06

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

EXAMPLES_ADVANCED.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
### Check PD state
66

77
Example on Framework 13 AMD Ryzen AI 300
8+
89
```
910
> sudo framework_tool.exe --pd-info
1011
Left / Ports 01
1112
Silicon ID: 0x3580
1213
Mode: MainFw
1314
Flash Row Size: 256 B
15+
Ports Enabled: 0, 1
1416
Bootloader Version: Base: 3.6.0.009, App: 0.0.01
1517
FW1 (Backup) Version: Base: 3.7.0.197, App: 0.0.0B
1618
FW2 (Main) Version: Base: 3.7.0.197, App: 0.0.0B
1719
Right / Ports 23
1820
Silicon ID: 0x3580
1921
Mode: MainFw
2022
Flash Row Size: 256 B
23+
Ports Enabled: 0, 1
2124
Bootloader Version: Base: 3.6.0.009, App: 0.0.01
2225
FW1 (Backup) Version: Base: 3.7.0.197, App: 0.0.0B
2326
FW2 (Main) Version: Base: 3.7.0.197, App: 0.0.0B

framework_lib/src/ccgx/device.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,4 +372,10 @@ impl PdController {
372372
self.ccgx_write(ControlRegisters::PdPortsEnable, &[mask])?;
373373
Ok(())
374374
}
375+
376+
pub fn get_port_status(&self) -> EcResult<u8> {
377+
let data = self.ccgx_read(ControlRegisters::PdPortsEnable, 1)?;
378+
assert_win_len(data.len(), 1);
379+
Ok(data[0])
380+
}
375381
}

framework_lib/src/commandline/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ fn print_single_pd_details(pd: &PdController) {
227227
} else {
228228
println!(" Failed to device info");
229229
}
230+
if let Ok(port_mask) = pd.get_port_status() {
231+
let ports = match port_mask {
232+
1 => "0",
233+
2 => "1",
234+
3 => "0, 1",
235+
_ => "None",
236+
};
237+
println!(" Ports Enabled: {}", ports);
238+
} else {
239+
println!(" Ports Enabled: Unknown");
240+
}
230241
pd.print_fw_info();
231242
}
232243

0 commit comments

Comments
 (0)