twizzler_driver::dma

Struct DmaPool

source
pub struct DmaPool { /* private fields */ }
Expand description

A pool for allocating DMA regions that all share a common access type and DMA options.

Implementations§

source§

impl DmaPool

source

pub fn new(spec: CreateSpec, access: Access, opts: DmaOptions) -> Self

Create a new DmaPool with access and DMA options, where each created underlying Twizzler object is created using the provided CreateSpec. If default (volatile) options are acceptable for the create spec, use the crate::dma::DmaPool::default_spec function.

source

pub fn default_spec() -> CreateSpec

Generate a default CreateSpec for use in creating Twizzler DMA objects. By default, Twizzler objects for DMA are placed in volatile memory with a volatile lifetime.

source

pub fn allocate<'a, T: DeviceSync>( &'a self, init: T, ) -> Result<DmaRegion<T>, AllocationError>

Allocate a new DmaRegion from the pool. The region will be initialized with the provided initial value.

source

pub fn allocate_array<'a, T: DeviceSync + Clone>( &'a self, count: usize, init: T, ) -> Result<DmaSliceRegion<T>, AllocationError>

Allocate a new DmaSliceRegion from the pool. Each entry in the region’s slice will be initialized with the provided initial value.

source

pub fn allocate_array_with<'a, T: DeviceSync>( &'a self, count: usize, init: impl Fn() -> T, ) -> Result<DmaSliceRegion<T>, AllocationError>

Allocate a new DmaSliceRegion from the pool. Each entry in the region’s slice will be initialized by running the provided closure.

Auto Trait Implementations§

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.