mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-26 08:42:32 +00:00
Skip EasyDMA slice location check if slice is empty
This commit is contained in:
parent
caad1111f9
commit
ed9fad8c7e
@ -1,7 +1,7 @@
|
||||
#![no_std]
|
||||
#![cfg_attr(
|
||||
feature = "nightly",
|
||||
feature(generic_associated_types, type_alias_impl_trait)
|
||||
feature(generic_associated_types, type_alias_impl_trait, slice_ptr_len)
|
||||
)]
|
||||
|
||||
#[cfg(not(any(
|
||||
|
@ -19,10 +19,10 @@ pub(crate) fn slice_in_ram<T>(slice: *const [T]) -> bool {
|
||||
ptr >= SRAM_LOWER && (ptr + len * core::mem::size_of::<T>()) < SRAM_UPPER
|
||||
}
|
||||
|
||||
/// Return an error if slice is not in RAM.
|
||||
/// Return an error if slice is not in RAM. Skips check if slice is zero-length.
|
||||
#[cfg(not(feature = "nrf51"))]
|
||||
pub(crate) fn slice_in_ram_or<T, E>(slice: *const [T], err: E) -> Result<(), E> {
|
||||
if slice_in_ram(slice) {
|
||||
if slice.len() > 0 && slice_in_ram(slice) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(err)
|
||||
|
Loading…
Reference in New Issue
Block a user