Next-generation FPGA SoC toolkit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
512 B

use core::ptr::{read_volatile, write_volatile};
const FLASH_CONTROL: *mut u32 = (0x02000100) as *mut u32;
const FLASH_START_ADDR: u32 = (0x03000000);
pub fn flash_set_div(div: u32) {
unsafe {
write_volatile(FLASH_CONTROL, div as u32);
}
}
pub fn flash_get_div() -> u32 {
unsafe {
return read_volatile(FLASH_CONTROL) as u32
}
}
pub fn flash_read_word(byte_offset: u32) -> u32 {
let mem = (FLASH_START_ADDR + byte_offset) as *mut u32;
unsafe {
return *mem
}
}