pub struct DeviceSlot {
    slot_id: u8,
    port_id: PortId,
    dcbaap: Register<u64>,
    hub: Arc<UsbHub>,
    interrupter: Arc<Mutex<Interrupter>>,
    event_loop: Arc<EventLoop>,
    mem: GuestMemory,
    enabled: AtomicBool,
    transfer_ring_controllers: Mutex<Vec<Option<TransferRingControllers>>>,
}

Fields§

§slot_id: u8§port_id: PortId§dcbaap: Register<u64>§hub: Arc<UsbHub>§interrupter: Arc<Mutex<Interrupter>>§event_loop: Arc<EventLoop>§mem: GuestMemory§enabled: AtomicBool§transfer_ring_controllers: Mutex<Vec<Option<TransferRingControllers>>>

Implementations§

source§

impl DeviceSlot

source

pub fn new( slot_id: u8, dcbaap: Register<u64>, hub: Arc<UsbHub>, interrupter: Arc<Mutex<Interrupter>>, event_loop: Arc<EventLoop>, mem: GuestMemory ) -> Self

Create a new device slot.

source

fn get_trc( &self, i: usize, stream_id: u16 ) -> Option<Arc<RingBufferController<TransferRingTrbHandler>>>

source

fn get_trcs(&self, i: usize) -> Option<TransferRingControllers>

source

fn set_trcs(&self, i: usize, trc: Option<TransferRingControllers>)

source

fn trc_len(&self) -> usize

source

pub fn ring_doorbell(&self, target: u8, stream_id: u16) -> Result<bool, Error>

The arguments are identical to the fields in each doorbell register. The target value: 1: Reserved 2: Control endpoint 3: Endpoint 1 out 4: Endpoint 1 in 5: Endpoint 2 out … 32: Endpoint 15 in

Steam ID will be useful when host controller support streams. The stream ID must be zero for endpoints that do not have streams configured. This function will return false if it fails to trigger transfer ring start.

source

pub fn enable(&self) -> bool

Enable the slot. This function returns false if it’s already enabled.

source

pub fn disable<C: FnMut(TrbCompletionCode) -> Result<(), ()> + 'static + Send>( fail_handle: Arc<dyn FailHandle>, slot: &Arc<DeviceSlot>, callback: C ) -> Result<(), Error>

Disable this device slot. If the slot is not enabled, callback will be invoked immediately with error. Otherwise, callback will be invoked when all trc is stopped.

source

pub fn set_address( self: &Arc<Self>, trb: &AddressDeviceCommandTrb ) -> Result<TrbCompletionCode, Error>

source

pub fn configure_endpoint( self: &Arc<Self>, trb: &ConfigureEndpointCommandTrb ) -> Result<TrbCompletionCode, Error>

source

pub fn evaluate_context( &self, trb: &EvaluateContextCommandTrb ) -> Result<TrbCompletionCode, Error>

source

pub fn reset_slot<C: FnMut(TrbCompletionCode) -> Result<(), ()> + 'static + Send>( fail_handle: Arc<dyn FailHandle>, slot: &Arc<DeviceSlot>, callback: C ) -> Result<(), Error>

Reset the device slot to default state and deconfigures all but the control endpoint.

source

pub fn stop_all_trc(&self, auto_callback: RingBufferStopCallback)

Stop all transfer ring controllers.

source

pub fn stop_endpoint<C: FnMut(TrbCompletionCode) -> Result<(), ()> + 'static + Send>( &self, fail_handle: Arc<dyn FailHandle>, endpoint_id: u8, cb: C ) -> Result<(), Error>

Stop an endpoint.

source

pub fn reset_endpoint<C: FnMut(TrbCompletionCode) -> Result<(), ()> + 'static + Send>( &self, fail_handle: Arc<dyn FailHandle>, endpoint_id: u8, cb: C ) -> Result<(), Error>

Reset an endpoint.

source

pub fn set_tr_dequeue_ptr( &self, endpoint_id: u8, stream_id: u16, ptr: u64 ) -> Result<TrbCompletionCode, Error>

Set transfer ring dequeue pointer.

source

fn reset(&self)

source

fn create_stream_trcs( self: &Arc<Self>, stream_context_array_addr: GuestAddress, max_pstreams: u8, device_context_index: u8 ) -> Result<TransferRingControllers, Error>

source

fn add_one_endpoint( self: &Arc<Self>, device_context_index: u8 ) -> Result<(), Error>

source

fn drop_one_endpoint( self: &Arc<Self>, device_context_index: u8 ) -> Result<(), Error>

source

fn get_device_context(&self) -> Result<DeviceContext, Error>

source

fn set_device_context(&self, device_context: DeviceContext) -> Result<(), Error>

source

fn copy_context( &self, input_context_ptr: GuestAddress, device_context_index: u8 ) -> Result<(), Error>

source

fn get_device_context_addr(&self) -> Result<GuestAddress, Error>

source

fn set_state(&self, state: DeviceSlotState) -> Result<(), Error>

source

pub fn halt_endpoint(&self, endpoint_id: u8) -> Result<(), Error>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V