forked from M-Labs/zynq-rs
Compare commits
3 Commits
6c9ff22a0a
...
7707399f51
Author | SHA1 | Date |
---|---|---|
Simon Renblad | 7707399f51 | |
Simon Renblad | 239bd2e65f | |
Simon Renblad | e4914f5872 |
|
@ -1,7 +1,7 @@
|
||||||
[target.armv7-none-eabihf]
|
[target.armv7-none-eabihf]
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C", "link-arg=-Tlink.x",
|
"-C", "link-arg=-Tlink.x",
|
||||||
"-C", "target-feature=a9,armv7-a,neon",
|
"-C", "target-feature=+a9,+armv7-a,+neon",
|
||||||
"-C", "target-cpu=cortex-a9",
|
"-C", "target-cpu=cortex-a9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ members = [
|
||||||
"experiments",
|
"experiments",
|
||||||
"szl",
|
"szl",
|
||||||
]
|
]
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use core::{
|
use core::{
|
||||||
ops::{Deref, DerefMut},
|
mem::{align_of, size_of}, ops::{Deref, DerefMut}, panic
|
||||||
mem::{align_of, size_of},
|
|
||||||
};
|
};
|
||||||
use alloc::alloc::{dealloc, Layout, LayoutError};
|
use alloc::alloc::{dealloc, Layout, LayoutError};
|
||||||
use crate::mmu::{L1_PAGE_SIZE, L1Table};
|
use crate::mmu::{L1_PAGE_SIZE, L1Table};
|
||||||
|
@ -20,7 +19,6 @@ impl<T> UncachedSlice<T> {
|
||||||
let layout = Layout::from_size_align(size, align)?;
|
let layout = Layout::from_size_align(size, align)?;
|
||||||
let ptr = unsafe { alloc::alloc::alloc(layout).cast::<T>() };
|
let ptr = unsafe { alloc::alloc::alloc(layout).cast::<T>() };
|
||||||
let start = ptr as usize;
|
let start = ptr as usize;
|
||||||
assert_eq!(start & (L1_PAGE_SIZE - 1), 0);
|
|
||||||
|
|
||||||
for page_start in (start..(start + size)).step_by(L1_PAGE_SIZE) {
|
for page_start in (start..(start + size)).step_by(L1_PAGE_SIZE) {
|
||||||
// non-shareable device
|
// non-shareable device
|
||||||
|
@ -31,10 +29,7 @@ impl<T> UncachedSlice<T> {
|
||||||
l1_section.bufferable = false;
|
l1_section.bufferable = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let slice = unsafe { core::slice::from_raw_parts_mut(ptr, len) };
|
let slice = unsafe { core::slice::from_raw_parts_mut(ptr, len) };
|
||||||
// verify size
|
|
||||||
assert!(unsafe { slice.get_unchecked(len) } as *const _ as usize <= start + size);
|
|
||||||
// initialize
|
// initialize
|
||||||
for e in slice.iter_mut() {
|
for e in slice.iter_mut() {
|
||||||
*e = default();
|
*e = default();
|
||||||
|
|
Loading…
Reference in New Issue