Struct devices::usb::xhci::ring_buffer::RingBuffer
source · pub struct RingBuffer {
name: String,
mem: GuestMemory,
dequeue_pointer: GuestAddress,
consumer_cycle_state: bool,
}
Expand description
Ring Buffer is segmented circular buffer in guest memory containing work items called transfer descriptors, each of which consists of one or more TRBs. Ring buffer logic is shared between transfer ring and command ring. Transfer Ring management is defined in xHCI spec 4.9.2.
Fields§
§name: String
§mem: GuestMemory
§dequeue_pointer: GuestAddress
§consumer_cycle_state: bool
Implementations§
source§impl RingBuffer
impl RingBuffer
sourcepub fn new(name: String, mem: GuestMemory) -> Self
pub fn new(name: String, mem: GuestMemory) -> Self
Create a new RingBuffer.
sourcepub fn dequeue_transfer_descriptor(
&mut self
) -> Result<Option<Vec<AddressedTrb>>, Error>
pub fn dequeue_transfer_descriptor( &mut self ) -> Result<Option<Vec<AddressedTrb>>, Error>
Dequeue next transfer descriptor from the transfer ring.
sourcepub fn get_dequeue_pointer(&self) -> GuestAddress
pub fn get_dequeue_pointer(&self) -> GuestAddress
Get dequeue pointer of the ring buffer.
sourcepub fn set_dequeue_pointer(&mut self, addr: GuestAddress)
pub fn set_dequeue_pointer(&mut self, addr: GuestAddress)
Set dequeue pointer of the ring buffer.
sourcepub fn get_consumer_cycle_state(&self) -> bool
pub fn get_consumer_cycle_state(&self) -> bool
Get consumer cycle state of the ring buffer.
sourcepub fn set_consumer_cycle_state(&mut self, state: bool)
pub fn set_consumer_cycle_state(&mut self, state: bool)
Set consumer cycle state of the ring buffer.
fn get_current_trb(&self) -> Result<Option<AddressedTrb>, Error>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for RingBuffer
impl Send for RingBuffer
impl Sync for RingBuffer
impl Unpin for RingBuffer
impl UnwindSafe for RingBuffer
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.