pub trait TransferDescriptorHandler {
// Required method
fn handle_transfer_descriptor(
&self,
descriptor: Vec<AddressedTrb>,
complete_event: Event,
) -> Result<()>;
// Provided method
fn cancel(&self, _callback: RingBufferStopCallback) { ... }
}
Expand description
TransferDescriptorHandler handles transfer descriptor. User should implement this trait and build a ring buffer controller with the struct.
Required Methods§
sourcefn handle_transfer_descriptor(
&self,
descriptor: Vec<AddressedTrb>,
complete_event: Event,
) -> Result<()>
fn handle_transfer_descriptor( &self, descriptor: Vec<AddressedTrb>, complete_event: Event, ) -> Result<()>
Process descriptor asynchronously, write complete_event when done.
Provided Methods§
sourcefn cancel(&self, _callback: RingBufferStopCallback)
fn cancel(&self, _callback: RingBufferStopCallback)
Cancel transfer descriptors. This is called when stopping a ring buffer controller, due to receiving a Stop Endpoint command. There may be one or more transfers in-flight at the hardware level and the xHCI spec says we need to cancel or complete them before sending the completion event for the Stop Endpoint command. Use the callback to send the completion event once all the in-flight ones are cleared.