#physical #accessing #space #busybox #devmem #dev-mem #register-map

ddevmem

Library for accessing the physical address space using /dev/mem similar to busybox devmem

7 releases

0.2.4 Oct 31, 2024
0.2.3 Oct 31, 2024
0.1.1 Oct 30, 2024

#4 in #physical

Download history 556/week @ 2024-10-29 48/week @ 2024-11-05 2/week @ 2024-11-19

606 downloads per month

MIT license

18KB
270 lines

ddevmem

Latest Version Documentation Downloads License

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