Nothing to see here, move along meow
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.1 kB View raw
1use core::ptr; 2 3pub const CAP: u32 = 0x00; 4#[allow(dead_code)] 5pub const VS: u32 = 0x08; 6#[allow(dead_code)] 7pub const INTMS: u32 = 0x0C; 8#[allow(dead_code)] 9pub const INTMC: u32 = 0x10; 10pub const CC: u32 = 0x14; 11pub const CSTS: u32 = 0x1C; 12pub const AQA: u32 = 0x24; 13pub const ASQ: u32 = 0x28; 14pub const ACQ: u32 = 0x30; 15 16pub const CC_EN: u32 = 1 << 0; 17pub const CC_IOSQES_SHIFT: u32 = 16; 18pub const CC_IOCQES_SHIFT: u32 = 20; 19 20pub const CSTS_RDY: u32 = 1 << 0; 21pub const CSTS_CFS: u32 = 1 << 1; 22 23#[inline] 24pub fn read32(base: usize, offset: u32) -> u32 { 25 unsafe { ptr::read_volatile((base + offset as usize) as *const u32) } 26} 27 28#[inline] 29pub fn write32(base: usize, offset: u32, val: u32) { 30 unsafe { ptr::write_volatile((base + offset as usize) as *mut u32, val) } 31} 32 33#[inline] 34pub fn read64(base: usize, offset: u32) -> u64 { 35 let lo = read32(base, offset) as u64; 36 let hi = read32(base, offset + 4) as u64; 37 lo | (hi << 32) 38} 39 40#[inline] 41pub fn write64(base: usize, offset: u32, val: u64) { 42 write32(base, offset, val as u32); 43 write32(base, offset + 4, (val >> 32) as u32); 44}