7 releases
0.2.4 | Oct 31, 2024 |
---|---|
0.2.3 | Oct 31, 2024 |
0.1.1 | Oct 30, 2024 |
#4 in #physical
606 downloads per month
18KB
270 lines
ddevmem
Rust library for accessing the physical address space using /dev/mem similar to busybox devmem
Installation
Add ddevmem
to your Cargo.toml
:
[dependencies]
ddevmem = "0.2.4"
Example
use ddevmem::{register_map, DevMem};
register_map! {
pub unsafe map MyRegisterMap {
0x00 => rw reg0: u32,
0x04 => ro reg1: u32,
0x08 => wo reg2: u32
}
}
let devmem = unsafe { DevMem::new(0xD0DE_0000, None).unwrap() };
let mut reg_map = unsafe { MyRegisterMap::new(std::sync::Arc::new(devmem)).unwrap() };
let (reg0_address, reg0_offset) = (reg_map.reg0_address(), reg_map.reg0_offset());
let reg1_value = *reg_map.reg1();
*reg_map.mut_reg2() = reg1_value;
License
Ddevmem is distributed under the terms of the MIT license. See terms and conditions here.
Dependencies
~140–490KB