Closed
Description
#40 landed CMSIS-style DCache cleaning and invalidating by address and size, both usize
. This maps well to the actual hardware operations but is inconvenient to use.
We could add some convenience methods that operate on normal Rust objects:
clean_dcache_by_slice<T>(slice: &[T])
which passesslice.as_ptr() as usize
andcore::mem::size_of<T>() * slice.len()
to the underlying methods,clean_dcache_by_ref<T>(obj: &T)
, which passesT as *const _ as usize
andcore::mem::size_of<T>()
to the underlying methods.- As above for
invalidate_dcache
andclean_invalidate_dcache
Big safety issue: all the cache methods operate on cache lines of 32 bytes. If you pass something whose size is not a multiple of 32, then some extra bytes after that object will be cleaned or invalidated. In general this is definitely unsafe. Perhaps these methods could panic on non-32-byte-multiple sizes?
Metadata
Metadata
Assignees
Labels
No labels