#physical #space #accessing #mapping #address

devmem

Small library for accessing the physical address space using /dev/mem

2 releases

0.1.1 Jul 23, 2021
0.1.0 Jul 23, 2021

#14 in #physical

Download history 111/week @ 2024-07-22 226/week @ 2024-07-29 141/week @ 2024-08-05 136/week @ 2024-08-12 168/week @ 2024-08-19 142/week @ 2024-08-26 87/week @ 2024-09-02 90/week @ 2024-09-09 189/week @ 2024-09-16 129/week @ 2024-09-23 217/week @ 2024-09-30 64/week @ 2024-10-07 68/week @ 2024-10-14 61/week @ 2024-10-21 82/week @ 2024-10-28 84/week @ 2024-11-04

296 downloads per month
Used in ocsd

MIT/Apache

7KB
70 lines

devmem-rs

Small Rust library for accessing the physical address space using /dev/mem

Documentation

Example

use devmem::Mapping

let mut mapping = unsafe {
    Mapping::new(0x1000_0000, 8).unwrap()
};
let data_to_write: Vec<u8> = vec![0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08];
mapping.copy_from_slice(&data_to_write);
    
let mapping = unsafe {
    Mapping::new(0x1000_0004, 4).unwrap()
};
let mut data_read: Vec<u8> = vec![0x00; 4];
mapping.copy_into_slice(&mut data_read);

assert_eq!(data_read, data_to_write[4..8]);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~44KB