Closed zhouhaoan closed 7 months ago
You could use the read()
method on Field
instances to extract bitfields out of raw integer values:
use aarch64_cpu::registers::*;
// Read the value of the register once
let esr = ESR_EL1.get();
// Extract fields from the `u64`
let ec = ESR_EL1::EC.read(esr);
let iss = ESR_EL1::ISS.read(esr);
Closing as I think vbe0201's answer is what you need. Please reopen if that's not the case.
I got a
u64
register value fromget()
method. But when I want to parse the value to get specify fields, I can't use those API in the crate. Moreover, it seems that register modules and structs doesn't implementFrom<u64>
trait. Are there some way to parse previously read values? Or just get values and read fields from raw registers?