pub struct PhysAddr(/* private fields */);Expand description
CPU-visible physical address of RAM (SDRAM, SRAM, etc.).
Distinct from DmaAddr and MmioAddr<T> so that a value intended
as a framebuffer origin cannot be silently assigned to a DMA source or
a register-block base.
Implementations§
Source§impl PhysAddr
impl PhysAddr
Sourcepub const fn offset(self, delta: u32) -> Self
pub const fn offset(self, delta: u32) -> Self
Offset this address by delta bytes, returning a new PhysAddr.
Saturating on overflow. No aliasing, MMU, or mapping check is performed — callers stay responsible for validity.
Sourcepub const fn sdram_bank(self) -> Option<u8>
pub const fn sdram_bank(self) -> Option<u8>
SDRAM bank index (0..SDRAM_BANK_COUNT) for Bank-2-based SDRAM,
or None if this address is not inside the SDRAM Bank 2 window.
Replaces the inline (addr - 0xD000_0000) / SDRAM_BANK_STRIDE
expression that framebuffer collision detection previously used.
Sourcepub unsafe fn as_mut_slice<'a>(self, len: usize) -> &'a mut [u8]
pub unsafe fn as_mut_slice<'a>(self, len: usize) -> &'a mut [u8]
Reconstruct a mutable byte slice spanning len bytes starting at
this address.
§Safety
The caller must ensure that:
- the region
[self, self+len)is mapped and writable for'a, - no other
&_or&mut _to any overlapping bytes exists for'a, - the region is not concurrently written by a DMA master (see
DmaAddrand theInFlight<T>handoff pattern).
Trait Implementations§
impl Copy for PhysAddr
impl Eq for PhysAddr
Source§impl Ord for PhysAddr
impl Ord for PhysAddr
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for PhysAddr
impl PartialOrd for PhysAddr
impl StructuralPartialEq for PhysAddr
Auto Trait Implementations§
impl Freeze for PhysAddr
impl RefUnwindSafe for PhysAddr
impl Send for PhysAddr
impl Sync for PhysAddr
impl Unpin for PhysAddr
impl UnsafeUnpin for PhysAddr
impl UnwindSafe for PhysAddr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more