Skip to main content

VMap

Struct VMap 

Source
pub struct VMap<D, R, C = Registered, const SIZE: usize = 0>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,
{ /* private fields */ }
Expand description

A reference to a virtual mapping for an shmem-based GEM object in kernel address space.

§Invariants

  • The size of owner is >= SIZE.
  • The memory pointed to by addr remains valid at least until this object is dropped.

Implementations§

Source§

impl<D, R, C, const SIZE: usize> VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source

pub fn owner(&self) -> &Object<D, C>

Borrows a reference to the object that owns this virtual mapping.

Trait Implementations§

Source§

impl<D, R, C, const SIZE: usize> Drop for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<D, R, C, const SIZE: usize> Io for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

fn addr(&self) -> usize

Returns the base address of this mapping.
Source§

fn maxsize(&self) -> usize

Returns the maximum size of this mapping.
Source§

fn io_addr<U>(&self, offset: usize) -> Result<usize>

Returns the absolute I/O address for a given offset, performing runtime bound checks.
Source§

fn try_read8(&self, offset: usize) -> Result<u8>
where Self: IoCapable<u8>,

Fallible 8-bit read with runtime bounds check.
Source§

fn try_read16(&self, offset: usize) -> Result<u16>
where Self: IoCapable<u16>,

Fallible 16-bit read with runtime bounds check.
Source§

fn try_read32(&self, offset: usize) -> Result<u32>
where Self: IoCapable<u32>,

Fallible 32-bit read with runtime bounds check.
Source§

fn try_read64(&self, offset: usize) -> Result<u64>
where Self: IoCapable<u64>,

Fallible 64-bit read with runtime bounds check.
Source§

fn try_write8(&self, value: u8, offset: usize) -> Result
where Self: IoCapable<u8>,

Fallible 8-bit write with runtime bounds check.
Source§

fn try_write16(&self, value: u16, offset: usize) -> Result
where Self: IoCapable<u16>,

Fallible 16-bit write with runtime bounds check.
Source§

fn try_write32(&self, value: u32, offset: usize) -> Result
where Self: IoCapable<u32>,

Fallible 32-bit write with runtime bounds check.
Source§

fn try_write64(&self, value: u64, offset: usize) -> Result
where Self: IoCapable<u64>,

Fallible 64-bit write with runtime bounds check.
Source§

fn read8(&self, offset: usize) -> u8
where Self: IoKnownSize + IoCapable<u8>,

Infallible 8-bit read with compile-time bounds check.
Source§

fn read16(&self, offset: usize) -> u16
where Self: IoKnownSize + IoCapable<u16>,

Infallible 16-bit read with compile-time bounds check.
Source§

fn read32(&self, offset: usize) -> u32
where Self: IoKnownSize + IoCapable<u32>,

Infallible 32-bit read with compile-time bounds check.
Source§

fn read64(&self, offset: usize) -> u64
where Self: IoKnownSize + IoCapable<u64>,

Infallible 64-bit read with compile-time bounds check.
Source§

fn write8(&self, value: u8, offset: usize)
where Self: IoKnownSize + IoCapable<u8>,

Infallible 8-bit write with compile-time bounds check.
Source§

fn write16(&self, value: u16, offset: usize)
where Self: IoKnownSize + IoCapable<u16>,

Infallible 16-bit write with compile-time bounds check.
Source§

fn write32(&self, value: u32, offset: usize)
where Self: IoKnownSize + IoCapable<u32>,

Infallible 32-bit write with compile-time bounds check.
Source§

fn write64(&self, value: u64, offset: usize)
where Self: IoKnownSize + IoCapable<u64>,

Infallible 64-bit write with compile-time bounds check.
Source§

fn try_read<T, L>(&self, location: L) -> Result<T>
where L: IoLoc<T>, Self: IoCapable<L::IoType>,

Generic fallible read with runtime bounds check. Read more
Source§

fn try_write<T, L>(&self, location: L, value: T) -> Result
where L: IoLoc<T>, Self: IoCapable<L::IoType>,

Generic fallible write with runtime bounds check. Read more
Source§

fn try_write_reg<T, L, V>(&self, value: V) -> Result
where L: IoLoc<T>, V: LocatedRegister<Location = L, Value = T>, Self: IoCapable<L::IoType>,

Generic fallible write of a fully-located register value. Read more
Source§

fn try_update<T, L, F>(&self, location: L, f: F) -> Result
where L: IoLoc<T>, Self: IoCapable<L::IoType>, F: FnOnce(T) -> T,

Generic fallible update with runtime bounds check. Read more
Source§

fn read<T, L>(&self, location: L) -> T
where L: IoLoc<T>, Self: IoKnownSize + IoCapable<L::IoType>,

Generic infallible read with compile-time bounds check. Read more
Source§

fn write<T, L>(&self, location: L, value: T)
where L: IoLoc<T>, Self: IoKnownSize + IoCapable<L::IoType>,

Generic infallible write with compile-time bounds check. Read more
Source§

fn write_reg<T, L, V>(&self, value: V)
where L: IoLoc<T>, V: LocatedRegister<Location = L, Value = T>, Self: IoKnownSize + IoCapable<L::IoType>,

Generic infallible write of a fully-located register value. Read more
Source§

fn update<T, L, F>(&self, location: L, f: F)
where L: IoLoc<T>, Self: IoKnownSize + IoCapable<L::IoType> + Sized, F: FnOnce(T) -> T,

Generic infallible update with compile-time bounds check. Read more
Source§

impl<D, R, C, const SIZE: usize> IoCapable<u8> for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

unsafe fn io_read(&self, address: usize) -> u8

Performs an I/O read of type T at address and returns the result. Read more
Source§

unsafe fn io_write(&self, value: u8, address: usize)

Performs an I/O write of value at address. Read more
Source§

impl<D, R, C, const SIZE: usize> IoCapable<u16> for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

unsafe fn io_read(&self, address: usize) -> u16

Performs an I/O read of type T at address and returns the result. Read more
Source§

unsafe fn io_write(&self, value: u16, address: usize)

Performs an I/O write of value at address. Read more
Source§

impl<D, R, C, const SIZE: usize> IoCapable<u32> for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

unsafe fn io_read(&self, address: usize) -> u32

Performs an I/O read of type T at address and returns the result. Read more
Source§

unsafe fn io_write(&self, value: u32, address: usize)

Performs an I/O write of value at address. Read more
Source§

impl<D, R, C, const SIZE: usize> IoCapable<u64> for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

unsafe fn io_read(&self, address: usize) -> u64

Performs an I/O read of type T at address and returns the result. Read more
Source§

unsafe fn io_write(&self, value: u64, address: usize)

Performs an I/O write of value at address. Read more
Source§

impl<D, R, C, const SIZE: usize> IoKnownSize for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>>,

Source§

const MIN_SIZE: usize = SIZE

Minimum usable size of this region.
Source§

fn io_addr_assert<U>(&self, offset: usize) -> usize

Returns the absolute I/O address for a given offset, performing compile-time bound checks.
Source§

impl<D, R, C, const SIZE: usize> Send for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>> + Send,

Source§

impl<D, R, C, const SIZE: usize> Sync for VMap<D, R, C, SIZE>
where D: DriverObject, C: DeviceContext, R: Deref<Target = Object<D, C>> + Sync,

Auto Trait Implementations§

§

impl<D, R, C, const SIZE: usize> Freeze for VMap<D, R, C, SIZE>
where R: Freeze,

§

impl<D, R, C, const SIZE: usize> RefUnwindSafe for VMap<D, R, C, SIZE>
where R: RefUnwindSafe,

§

impl<D, R, C, const SIZE: usize> Unpin for VMap<D, R, C, SIZE>
where R: Unpin,

§

impl<D, R, C, const SIZE: usize> UnsafeUnpin for VMap<D, R, C, SIZE>
where R: UnsafeUnpin,

§

impl<D, R, C, const SIZE: usize> UnwindSafe for VMap<D, R, C, SIZE>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> KnownSize for T

Source§

fn size(_: *const T) -> usize

Get the size of an object of this type in bytes, with the metadata of the given pointer.
Source§

impl<T> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U, const N: u32> TryIntoBounded<T, N> for U
where T: Integer, U: TryInto<T>,

Source§

fn try_into_bounded(self) -> Option<Bounded<T, N>>

Attempts to convert self into a Bounded using N bits. Read more