|
@ -9,17 +9,16 @@ fn main() -> Result<()> { |
|
|
let mut link = WchLink::open_nth(0)?; |
|
|
let mut link = WchLink::open_nth(0)?; |
|
|
|
|
|
|
|
|
let resp = link.send_command(commands::control::GetProbeInfo)?; |
|
|
let resp = link.send_command(commands::control::GetProbeInfo)?; |
|
|
|
|
|
println!("probe info: {:?}", resp); |
|
|
println!("=> {:?}", resp); |
|
|
|
|
|
|
|
|
|
|
|
let r = link.send_command(commands::control::AttachChip)?; |
|
|
let r = link.send_command(commands::control::AttachChip)?; |
|
|
println!("=> {:?}", r); |
|
|
println!("chip info: {:?}", r); |
|
|
|
|
|
|
|
|
let protected = link.send_command(commands::GetChipProtected)?; |
|
|
let protected = link.send_command(commands::GetChipProtected)?; |
|
|
println!("protected => {:?}", protected); |
|
|
println!("protected => {:?}", protected); |
|
|
|
|
|
|
|
|
let uid = link.send_command(commands::GetChipId); |
|
|
let uid = link.send_command(commands::GetChipId)?; |
|
|
println!("=> {}", uid); |
|
|
println!("UID => {}", uid); |
|
|
|
|
|
|
|
|
// read csr
|
|
|
// read csr
|
|
|
link.send_command(DmiOp::write(0x10, 0x80000001))?; |
|
|
link.send_command(DmiOp::write(0x10, 0x80000001))?; |
|
@ -32,7 +31,7 @@ fn main() -> Result<()> { |
|
|
println!("marchid => {:08x}", marchid.data); |
|
|
println!("marchid => {:08x}", marchid.data); |
|
|
let marchid = marchid.data; |
|
|
let marchid = marchid.data; |
|
|
println!( |
|
|
println!( |
|
|
"{}{}{}-{}{}{}", |
|
|
"Parsed marchid: {}{}{}-{}{}{}", |
|
|
(((marchid >> 26) & 0x1F) + 64) as u8 as char, |
|
|
(((marchid >> 26) & 0x1F) + 64) as u8 as char, |
|
|
(((marchid >> 21) & 0x1F) + 64) as u8 as char, |
|
|
(((marchid >> 21) & 0x1F) + 64) as u8 as char, |
|
|
(((marchid >> 16) & 0x1F) + 64) as u8 as char, |
|
|
(((marchid >> 16) & 0x1F) + 64) as u8 as char, |
|
|