pub struct Device<Ctx: DeviceContext = Normal>(/* private fields */);Expand description
The platform device representation.
This structure represents the Rust abstraction for a C struct platform_device. The
implementation abstracts the usage of an already existing C struct platform_device within Rust
code that we get passed from the C side.
§Invariants
A Device instance represents a valid struct platform_device created by the C portion of
the kernel.
Implementations§
Source§impl<Ctx: DeviceContext> Device<Ctx>
impl<Ctx: DeviceContext> Device<Ctx>
Sourcepub fn resource_by_index(&self, index: u32) -> Option<&Resource>
pub fn resource_by_index(&self, index: u32) -> Option<&Resource>
Returns the resource at index, if any.
Sourcepub fn resource_by_name(&self, name: &CStr) -> Option<&Resource>
pub fn resource_by_name(&self, name: &CStr) -> Option<&Resource>
Returns the resource with a given name, if any.
Source§impl Device<Bound>
impl Device<Bound>
Sourcepub fn io_request_by_index(&self, index: u32) -> Option<IoRequest<'_>>
pub fn io_request_by_index(&self, index: u32) -> Option<IoRequest<'_>>
Returns an IoRequest for the resource at index, if any.
Sourcepub fn io_request_by_name(&self, name: &CStr) -> Option<IoRequest<'_>>
pub fn io_request_by_name(&self, name: &CStr) -> Option<IoRequest<'_>>
Returns an IoRequest for the resource with a given name, if any.
Source§impl Device<Bound>
impl Device<Bound>
Sourcepub fn irq_by_index(&self, index: u32) -> Result<IrqRequest<'_>>
pub fn irq_by_index(&self, index: u32) -> Result<IrqRequest<'_>>
Returns an IrqRequest for the IRQ at the given index, if any.
Sourcepub fn optional_irq_by_index(&self, index: u32) -> Result<IrqRequest<'_>>
pub fn optional_irq_by_index(&self, index: u32) -> Result<IrqRequest<'_>>
Returns an IrqRequest for the IRQ at the given index, but does not
print an error if the IRQ cannot be obtained.
Sourcepub fn irq_by_name(&self, name: &CStr) -> Result<IrqRequest<'_>>
pub fn irq_by_name(&self, name: &CStr) -> Result<IrqRequest<'_>>
Returns an IrqRequest for the IRQ with the given name, if any.
Sourcepub fn optional_irq_by_name(&self, name: &CStr) -> Result<IrqRequest<'_>>
pub fn optional_irq_by_name(&self, name: &CStr) -> Result<IrqRequest<'_>>
Returns an IrqRequest for the IRQ with the given name, but does not
print an error if the IRQ cannot be obtained.
Sourcepub unsafe fn request_irq_by_index<'a, T: Handler + 'a>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<Registration<'a, T>, Error> + 'a
pub unsafe fn request_irq_by_index<'a, T: Handler + 'a>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<Registration<'a, T>, Error> + 'a
Returns a irq::Registration for the IRQ at the given index.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_irq_by_name<'a, T: Handler + 'a>(
&'a self,
flags: Flags,
irq_name: &'a CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<Registration<'a, T>, Error> + 'a
pub unsafe fn request_irq_by_name<'a, T: Handler + 'a>( &'a self, flags: Flags, irq_name: &'a CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<Registration<'a, T>, Error> + 'a
Returns a irq::Registration for the IRQ with the given name.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_optional_irq_by_index<'a, T: Handler + 'a>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<Registration<'a, T>, Error> + 'a
pub unsafe fn request_optional_irq_by_index<'a, T: Handler + 'a>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<Registration<'a, T>, Error> + 'a
Does the same as Self::request_irq_by_index, except that it does
not print an error message if the IRQ cannot be obtained.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_optional_irq_by_name<'a, T: Handler + 'a>(
&'a self,
flags: Flags,
irq_name: &'a CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<Registration<'a, T>, Error> + 'a
pub unsafe fn request_optional_irq_by_name<'a, T: Handler + 'a>( &'a self, flags: Flags, irq_name: &'a CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<Registration<'a, T>, Error> + 'a
Does the same as Self::request_irq_by_name, except that it does
not print an error message if the IRQ cannot be obtained.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_threaded_irq_by_index<'a, T: ThreadedHandler + 'a>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
pub unsafe fn request_threaded_irq_by_index<'a, T: ThreadedHandler + 'a>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
Returns a irq::ThreadedRegistration for the IRQ at the given index.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_threaded_irq_by_name<'a, T: ThreadedHandler + 'a>(
&'a self,
flags: Flags,
irq_name: &'a CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
pub unsafe fn request_threaded_irq_by_name<'a, T: ThreadedHandler + 'a>( &'a self, flags: Flags, irq_name: &'a CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
Returns a irq::ThreadedRegistration for the IRQ with the given name.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_optional_threaded_irq_by_index<'a, T: ThreadedHandler + 'a>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
pub unsafe fn request_optional_threaded_irq_by_index<'a, T: ThreadedHandler + 'a>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
Does the same as Self::request_threaded_irq_by_index, except
that it does not print an error message if the IRQ cannot be
obtained.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.
Sourcepub unsafe fn request_optional_threaded_irq_by_name<'a, T: ThreadedHandler + 'a>(
&'a self,
flags: Flags,
irq_name: &'a CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
pub unsafe fn request_optional_threaded_irq_by_name<'a, T: ThreadedHandler + 'a>( &'a self, flags: Flags, irq_name: &'a CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> impl PinInit<ThreadedRegistration<'a, T>, Error> + 'a
Does the same as Self::request_threaded_irq_by_name, except that
it does not print an error message if the IRQ cannot be obtained.
§Safety
Callers must not mem::forget() the resulting registration or otherwise prevent its
Drop implementation from running.