kernel::grant

Struct GrantKernelData

Source
pub struct GrantKernelData<'a> { /* private fields */ }
Expand description

This GrantKernelData object provides a handle to access upcalls and process buffers stored on behalf of a particular grant/driver.

Capsules gain access to a GrantKernelData object by calling Grant::enter(). From there, they can schedule upcalls or access process buffers.

It is expected that this type will only exist as a short-lived stack allocation, so its size is not a significant concern.

Implementations§

Source§

impl<'a> GrantKernelData<'a>

Source

pub fn schedule_upcall( &self, subscribe_num: usize, r: (usize, usize, usize), ) -> Result<(), UpcallError>

Schedule the specified upcall for the process with r0, r1, r2 as provided values.

Capsules call this function to schedule upcalls, and upcalls are identified by the subscribe_num, which must match the subscribe number used when the upcall was originally subscribed by a process. subscribe_nums are indexed starting at zero.

Source

pub fn remove_upcall(&self, subscribe_num: usize) -> Option<Task>

Search the work queue for the first pending operation with the given subscribe_num and if one exists remove it from the task queue.

Returns the associated [Task] if one was found, otherwise returns None.

Source

pub fn remove_pending_upcalls(&self, subscribe_num: usize) -> usize

Remove all scheduled upcalls with the given subscribe_num from the task queue.

Returns the number of removed upcalls.

Source

pub fn get_readonly_processbuffer( &self, allow_ro_num: usize, ) -> Result<ReadOnlyProcessBufferRef<'_>, Error>

Returns a lifetime limited reference to the requested ReadOnlyProcessBuffer.

The len of the returned ReadOnlyProcessBuffer must be checked by the caller to ensure that a buffer has in fact been allocated. An unallocated buffer will be returned as a ReadOnlyProcessBuffer of length 0.

The ReadOnlyProcessBuffer is only valid for as long as this object is valid, i.e. the lifetime of the app enter closure.

If the specified allow number is invalid, then a crate::process::Error::AddressOutOfBounds will be returned. This returns a crate::process::Error to allow for easy chaining of this function with the ReadOnlyProcessBuffer::enter() function with and_then.

Source

pub fn get_readwrite_processbuffer( &self, allow_rw_num: usize, ) -> Result<ReadWriteProcessBufferRef<'_>, Error>

Returns a lifetime limited reference to the requested ReadWriteProcessBuffer.

The length of the returned ReadWriteProcessBuffer must be checked by the caller to ensure that a buffer has in fact been allocated. An unallocated buffer will be returned as a ReadWriteProcessBuffer of length 0.

The ReadWriteProcessBuffer is only value for as long as this object is valid, i.e. the lifetime of the app enter closure.

If the specified allow number is invalid, then a crate::process::Error::AddressOutOfBounds will be returned. This returns a crate::process::Error to allow for easy chaining of this function with the ReadWriteProcessBuffer::enter() function with and_then.

Auto Trait Implementations§

§

impl<'a> Freeze for GrantKernelData<'a>

§

impl<'a> !RefUnwindSafe for GrantKernelData<'a>

§

impl<'a> !Send for GrantKernelData<'a>

§

impl<'a> !Sync for GrantKernelData<'a>

§

impl<'a> Unpin for GrantKernelData<'a>

§

impl<'a> !UnwindSafe for GrantKernelData<'a>

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.