Struct devices::usb::xhci::ring_buffer_controller::RingBufferController
source · pub struct RingBufferController<T: 'static + TransferDescriptorHandler> {
name: String,
state: Mutex<RingBufferState>,
stop_callback: Mutex<Vec<RingBufferStopCallback>>,
ring_buffer: Mutex<RingBuffer>,
handler: Mutex<T>,
event_loop: Arc<EventLoop>,
event: Event,
}
Expand description
RingBufferController owns a ring buffer. It lives on a event_loop. It will pop out transfer descriptor and let TransferDescriptorHandler handle it.
Fields§
§name: String
§state: Mutex<RingBufferState>
§stop_callback: Mutex<Vec<RingBufferStopCallback>>
§ring_buffer: Mutex<RingBuffer>
§handler: Mutex<T>
§event_loop: Arc<EventLoop>
§event: Event
Implementations§
source§impl RingBufferController<CommandRingTrbHandler>
impl RingBufferController<CommandRingTrbHandler>
pub fn new( mem: GuestMemory, event_loop: Arc<EventLoop>, slots: DeviceSlots, interrupter: Arc<Mutex<Interrupter>> ) -> Result<Arc<RingBufferController<CommandRingTrbHandler>>, RingBufferControllerError>
source§impl<T> RingBufferController<T>where
T: 'static + TransferDescriptorHandler + Send,
impl<T> RingBufferController<T>where
T: 'static + TransferDescriptorHandler + Send,
sourcepub fn new_with_handler(
name: String,
mem: GuestMemory,
event_loop: Arc<EventLoop>,
handler: T
) -> Result<Arc<RingBufferController<T>>, Error>
pub fn new_with_handler( name: String, mem: GuestMemory, event_loop: Arc<EventLoop>, handler: T ) -> Result<Arc<RingBufferController<T>>, Error>
Create a ring buffer controller and add it to event loop.
fn lock_ring_buffer(&self) -> MutexGuard<'_, RingBuffer>
sourcepub fn get_dequeue_pointer(&self) -> GuestAddress
pub fn get_dequeue_pointer(&self) -> GuestAddress
Get dequeue pointer of the internal ring buffer.
sourcepub fn set_dequeue_pointer(&self, ptr: GuestAddress)
pub fn set_dequeue_pointer(&self, ptr: GuestAddress)
Set dequeue pointer of the internal ring buffer.
sourcepub fn get_consumer_cycle_state(&self) -> bool
pub fn get_consumer_cycle_state(&self) -> bool
Get consumer cycle state.
sourcepub fn set_consumer_cycle_state(&self, state: bool)
pub fn set_consumer_cycle_state(&self, state: bool)
Set consumer cycle state.
sourcepub fn stop(&self, callback: RingBufferStopCallback)
pub fn stop(&self, callback: RingBufferStopCallback)
Stop the ring buffer asynchronously.
source§impl RingBufferController<TransferRingTrbHandler>
impl RingBufferController<TransferRingTrbHandler>
pub fn new( mem: GuestMemory, port: Arc<UsbPort>, event_loop: Arc<EventLoop>, interrupter: Arc<Mutex<Interrupter>>, slot_id: u8, endpoint_id: u8, device_slot: Weak<DeviceSlot>, stream_id: Option<u16> ) -> Result<Arc<RingBufferController<TransferRingTrbHandler>>, Error>
Trait Implementations§
source§impl<T: 'static + TransferDescriptorHandler> Display for RingBufferController<T>
impl<T: 'static + TransferDescriptorHandler> Display for RingBufferController<T>
source§impl<T> Drop for RingBufferController<T>where
T: 'static + TransferDescriptorHandler,
impl<T> Drop for RingBufferController<T>where
T: 'static + TransferDescriptorHandler,
source§impl<T> EventHandler for RingBufferController<T>where
T: 'static + TransferDescriptorHandler + Send,
impl<T> EventHandler for RingBufferController<T>where
T: 'static + TransferDescriptorHandler + Send,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for RingBufferController<T>
impl<T> Send for RingBufferController<T>where
T: Send,
impl<T> Sync for RingBufferController<T>where
T: Send,
impl<T> Unpin for RingBufferController<T>where
T: Unpin,
impl<T> !UnwindSafe for RingBufferController<T>
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.