Device in kernel::platform - Rust
Skip to main content Device kernel :: platform Struct Device Source 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> Source pub fn resource_by_index (&self, index: u32 ) -> Option <& Resource > Returns the resource at index , if any. Source pub fn resource_by_name (&self, name: & CStr ) -> Option <& Resource > Returns the resource with a given name , if any. Source § impl Device < Bound > Source pub fn io_request_by_index (&self, index: u32 ) -> Option < IoRequest <'_>> Returns an IoRequest for the resource at index , if any.
Source 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 > Source pub fn irq_by_index (&self, index: u32 ) -> Result < IrqRequest <'_>> Returns an IrqRequest for the IRQ at the given index, if any. Source 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.
Source pub fn irq_by_name (&self, name: & CStr ) -> Result < IrqRequest <'_>> Returns an IrqRequest for the IRQ with the given name, if any. Source 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. Source 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.
Source 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. Source 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.
Source 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.
Source 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.
Source 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.
Source 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.
Source 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.
Trait Implementations § Source § impl AlwaysRefCounted for Device Source § fn inc_ref (&self) Increments the reference count on the object. Source § unsafe fn dec_ref (obj: NonNull <Self>) Decrements the reference count on the object. Read more Source § impl<Ctx: DeviceContext > AsBusDevice <Ctx> for Device <Ctx> Source § const OFFSET : usize The relative offset to the device field. Read more Source § unsafe fn from_device (dev: & Device <Ctx>) -> &Self where Self: Sized , Convert a reference to Device into Self .
Read more Source § impl<Ctx: DeviceContext > AsRef < Device <Ctx>> for Device <Ctx> Source § fn as_ref (&self) -> & Device <Ctx> Converts this type into a shared reference of the (usually inferred) input type. Source § impl<'a> Deref for Device < CoreInternal <'a>> Source § type Target = Device < Core <'a>> The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value.
Source § impl<'a> Deref for Device < Core <'a>> Source § type Target = Device < Bound > The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl Deref for Device < BoundInternal > Source § type Target = Device < Bound > The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl Deref for Device < Bound > Source § type Target = Device The resulting type after dereferencing.
Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl<'a> Device <'a> for Device < Core <'a>> Source § unsafe fn dma_set_mask (&self, mask: DmaMask ) -> Result Set up the device’s DMA streaming addressing capabilities. Read more Source § unsafe fn dma_set_coherent_mask (&self, mask: DmaMask ) -> Result Set up the device’s DMA coherent addressing capabilities. Read more Source § unsafe fn dma_set_mask_and_coherent (&self, mask: DmaMask ) -> Result Set up the device’s DMA addressing capabilities.
Read more Source § unsafe fn dma_set_max_seg_size (&self, size: u32 ) Set the maximum size of a single DMA segment the device may request. Read more Source § impl From <& Device < Bound >> for ARef < Device > Source § fn from (dev: & Device < Bound >) -> Self Converts to this type from the input type. Source § impl From <& Device < BoundInternal >> for ARef < Device > Source § fn from (dev: & Device < Boun
The rest of this page is on the live site.