pub struct MmioPtr<T, Access: Accessible>(/* private fields */);Expand description
Represents a pointer to an MMIO address - with specific access permissions - at which a register might be located.
Implementations§
Source§impl<T, R> MmioPtr<T, (R, NoWrite)>where
(R, NoWrite): Accessible,
impl<T, R> MmioPtr<T, (R, NoWrite)>where
(R, NoWrite): Accessible,
Sourcepub const unsafe fn new(ptr: *const T) -> Self
pub const unsafe fn new(ptr: *const T) -> Self
Constructs a new, read-only MMIO pointer wrapper.
§Safety
The caller must guarantee the safety preconditions of
[core::ptr::read_volatile()] for the lifetime of MmioPtr. In
particular…
-
that
ptris aligned and points to a mapped MMIO address; -
the mapping remains valid for the lifetime of the returned
MmioPtr(and any copies of it); -
accesses must never trap.
Note that it is not assumed that the backing memory is immutable.
Source§impl<T, Access: Writable> MmioPtr<T, Access>
impl<T, Access: Writable> MmioPtr<T, Access>
Sourcepub const unsafe fn new(ptr: *mut T) -> Self
pub const unsafe fn new(ptr: *mut T) -> Self
Constructs a new, writable MMIO pointer wrapper.
§Safety
The caller must guarantee the safety preconditions of
[core::ptr::read_volatile()] (if readable) and
[core::ptr::write_volatile()] for the lifetime of MmioPtr. In
particular…
-
that
ptris aligned and points to a mapped MMIO address; -
the mapping remains valid for the lifetime of the returned
MmioPtr(and any copies of it); -
accesses must never trap.
Also,
- If
Accessexpresses safe-writability (seeSafeWrite), that writing any value whatsoever to this address cannot result in undefined behaviour.
Note that it is not assumed that the backing memory is immutable, or
that a writable MmioPtr has exclusive access to it.
Source§impl<T, Access: Accessible> MmioPtr<T, Access>
impl<T, Access: Accessible> MmioPtr<T, Access>
Sourcepub const fn restrict<NewAccess>(self) -> MmioPtr<T, NewAccess>where
NewAccess: Accessible,
Access: AccessRestrictsTo<NewAccess>,
pub const fn restrict<NewAccess>(self) -> MmioPtr<T, NewAccess>where
NewAccess: Accessible,
Access: AccessRestrictsTo<NewAccess>,
Restricts the access permissions of this pointer.
Trait Implementations§
Source§impl<T, Access: Accessible> Clone for MmioPtr<T, Access>
impl<T, Access: Accessible> Clone for MmioPtr<T, Access>
impl<T, Access: Accessible> Copy for MmioPtr<T, Access>
Source§impl<T: Debug, Access: Debug + Accessible> Debug for MmioPtr<T, Access>
impl<T: Debug, Access: Debug + Accessible> Debug for MmioPtr<T, Access>
Source§impl<T, Access> IoHandle for MmioPtr<T, Access>where
T: Copy,
Access: Accessible,
impl<T, Access> IoHandle for MmioPtr<T, Access>where
T: Copy,
Access: Accessible,
Source§impl<Access> ReadHandle for MmioPtr<u8, Access>where
Access: Readable,
impl<Access> ReadHandle for MmioPtr<u8, Access>where
Access: Readable,
Source§impl<Access> ReadHandle for MmioPtr<u16, Access>where
Access: Readable,
impl<Access> ReadHandle for MmioPtr<u16, Access>where
Access: Readable,
Source§impl<Access> ReadHandle for MmioPtr<u32, Access>where
Access: Readable,
impl<Access> ReadHandle for MmioPtr<u32, Access>where
Access: Readable,
Source§impl<Access> ReadHandle for MmioPtr<u64, Access>where
Access: Readable,
impl<Access> ReadHandle for MmioPtr<u64, Access>where
Access: Readable,
impl<T, Access: Accessible> Send for MmioPtr<T, Access>
impl<T, Access: Accessible> Sync for MmioPtr<T, Access>
Source§impl<Access> WriteHandle for MmioPtr<u8, Access>where
Access: Writable,
impl<Access> WriteHandle for MmioPtr<u8, Access>where
Access: Writable,
Source§impl<Access> WriteHandle for MmioPtr<u16, Access>where
Access: Writable,
impl<Access> WriteHandle for MmioPtr<u16, Access>where
Access: Writable,
Source§impl<Access> WriteHandle for MmioPtr<u32, Access>where
Access: Writable,
impl<Access> WriteHandle for MmioPtr<u32, Access>where
Access: Writable,
Auto Trait Implementations§
impl<T, Access> Freeze for MmioPtr<T, Access>
impl<T, Access> RefUnwindSafe for MmioPtr<T, Access>where
T: RefUnwindSafe,
Access: RefUnwindSafe,
impl<T, Access> Unpin for MmioPtr<T, Access>where
Access: Unpin,
impl<T, Access> UnsafeUnpin for MmioPtr<T, Access>
impl<T, Access> UnwindSafe for MmioPtr<T, Access>where
T: RefUnwindSafe,
Access: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)