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 fn request_irq_by_index<'a, T: Handler + 'static>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<Registration<T>, Error> + 'a>
pub fn request_irq_by_index<'a, T: Handler + 'static>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<Registration<T>, Error> + 'a>
Returns a irq::Registration
for the IRQ at the given index.
Sourcepub fn request_irq_by_name<'a, T: Handler + 'static>(
&'a self,
flags: Flags,
irq_name: &CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<Registration<T>, Error> + 'a>
pub fn request_irq_by_name<'a, T: Handler + 'static>( &'a self, flags: Flags, irq_name: &CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<Registration<T>, Error> + 'a>
Returns a irq::Registration
for the IRQ with the given name.
Sourcepub fn request_optional_irq_by_index<'a, T: Handler + 'static>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<Registration<T>, Error> + 'a>
pub fn request_optional_irq_by_index<'a, T: Handler + 'static>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<Registration<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.
Sourcepub fn request_optional_irq_by_name<'a, T: Handler + 'static>(
&'a self,
flags: Flags,
irq_name: &CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<Registration<T>, Error> + 'a>
pub fn request_optional_irq_by_name<'a, T: Handler + 'static>( &'a self, flags: Flags, irq_name: &CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<Registration<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.
Sourcepub fn request_threaded_irq_by_index<'a, T: ThreadedHandler + 'static>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
pub fn request_threaded_irq_by_index<'a, T: ThreadedHandler + 'static>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
Returns a irq::ThreadedRegistration
for the IRQ at the given index.
Sourcepub fn request_threaded_irq_by_name<'a, T: ThreadedHandler + 'static>(
&'a self,
flags: Flags,
irq_name: &CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
pub fn request_threaded_irq_by_name<'a, T: ThreadedHandler + 'static>( &'a self, flags: Flags, irq_name: &CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
Returns a irq::ThreadedRegistration
for the IRQ with the given name.
Sourcepub fn request_optional_threaded_irq_by_index<'a, T: ThreadedHandler + 'static>(
&'a self,
flags: Flags,
index: u32,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
pub fn request_optional_threaded_irq_by_index<'a, T: ThreadedHandler + 'static>( &'a self, flags: Flags, index: u32, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<ThreadedRegistration<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.
Sourcepub fn request_optional_threaded_irq_by_name<'a, T: ThreadedHandler + 'static>(
&'a self,
flags: Flags,
irq_name: &CStr,
name: &'static CStr,
handler: impl PinInit<T, Error> + 'a,
) -> Result<impl PinInit<ThreadedRegistration<T>, Error> + 'a>
pub fn request_optional_threaded_irq_by_name<'a, T: ThreadedHandler + 'static>( &'a self, flags: Flags, irq_name: &CStr, name: &'static CStr, handler: impl PinInit<T, Error> + 'a, ) -> Result<impl PinInit<ThreadedRegistration<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.
Trait Implementations§
Source§impl AlwaysRefCounted for Device
impl AlwaysRefCounted for Device
Source§impl Deref for Device<CoreInternal>
impl Deref for Device<CoreInternal>
Source§impl Device for Device<Core>
impl Device for Device<Core>
Source§impl From<&Device<CoreInternal>> for ARef<Device>
impl From<&Device<CoreInternal>> for ARef<Device>
Source§fn from(dev: &Device<CoreInternal>) -> Self
fn from(dev: &Device<CoreInternal>) -> Self
impl Send for Device
impl Sync for Device
Auto Trait Implementations§
impl<Ctx = Normal> !Freeze for Device<Ctx>
impl<Ctx = Normal> !RefUnwindSafe for Device<Ctx>
impl<Ctx = Normal> !Send for Device<Ctx>
impl<Ctx = Normal> !Sync for Device<Ctx>
impl<Ctx = Normal> !Unpin for Device<Ctx>
impl<Ctx> UnwindSafe for Device<Ctx>where
Ctx: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot
. Read more