pub struct EndpointProxy { /* private fields */ }Implementations§
Source§impl EndpointProxy
impl EndpointProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.hardware.usb.endpoint/Endpoint.
Sourcepub fn take_event_stream(&self) -> EndpointEventStream
pub fn take_event_stream(&self) -> EndpointEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn get_info(
&self,
) -> QueryResponseFut<EndpointGetInfoResult, DefaultFuchsiaResourceDialect>
pub fn get_info( &self, ) -> QueryResponseFut<EndpointGetInfoResult, DefaultFuchsiaResourceDialect>
Gets endpoint information
Sourcepub fn register_vmos(
&self,
vmo_ids: &[VmoInfo],
) -> QueryResponseFut<Vec<VmoHandle>, DefaultFuchsiaResourceDialect>
pub fn register_vmos( &self, vmo_ids: &[VmoInfo], ) -> QueryResponseFut<Vec<VmoHandle>, DefaultFuchsiaResourceDialect>
Registers and pins VMOs to the vmo_ids. Returns
- vmo: Handles to successfully registered vmo_ids. VMO IDs that are already are registered to will fail.
Sourcepub fn unregister_vmos(
&self,
vmo_ids: &[u64],
) -> QueryResponseFut<(Vec<u64>, Vec<i32>), DefaultFuchsiaResourceDialect>
pub fn unregister_vmos( &self, vmo_ids: &[u64], ) -> QueryResponseFut<(Vec<u64>, Vec<i32>), DefaultFuchsiaResourceDialect>
Unregisters the VMOs corresponding to the vmo_ids. Returns
- failed_vmo_ids: vmo_ids that failed to unregister.
- errors: Error values that correspond 1:1 to failed_vmo_ids above.
Sourcepub fn queue_requests(&self, req: Vec<Request>) -> Result<(), Error>
pub fn queue_requests(&self, req: Vec<Request>) -> Result<(), Error>
Submit Requests to queue. Processed starting with the 0th Request. Submitting a vector of Requests allows for pre-buffering.
Clients are responsible for cache management and ensuring cache coherency. The explanation to follow concerns VMOs that have been previously registered via RegisterVmos. The following rules must be followed:
-
After writing to VMO-backed buffers, the caller must call zx_cache_flush with ZX_CACHE_FLUSH_DATA before invoking QueueRequests, causing the hardware to DMA-process the buffer. This avoids both stale buffer data being DMA-read, and a concurrent race between the hardware and CPU to update the same addresses.
-
Before reading from VMO-backed buffers, the caller must call zx_cache_flush with ZX_CACHE_FLUSH_DATA | ZX_CACHE_FLUSH_INVALIDATE after the buffer contents have been DMA-written by the hardware. This implies a non-dirty cache (see #1 above) and ensures any subsequent CPU-reads fetch the previously DMA-written data from RAM.
Failing to adhere to these rules will result in the exchange of corrupted and/or stale data. If the VMO is not virtually mapped (uncommon), zx_vmo_op_range should be used in lieu of zx_cache_flush. If the usb::FidlRequest types are in use, they contain helpers for these operations.
Requests may be pre-buffered. In other words, requests may be queued for data that is not present/ready in the buffer yet. The USB Endpoint Server consuming requests does not care if the data in the buffer is ready or not and will always process requests on schedule. It is the responsibility of the USB Endpoint Client that submits requests to ensure that data is ready on schedule (taking into consideration cache management above).
- Definition of “on schedule” varies for different endpoints and controllers. In general,
this will be communicated by the
lead_timeparameter returned byGetInfo.
Sourcepub fn cancel_all(
&self,
) -> QueryResponseFut<EndpointCancelAllResult, DefaultFuchsiaResourceDialect>
pub fn cancel_all( &self, ) -> QueryResponseFut<EndpointCancelAllResult, DefaultFuchsiaResourceDialect>
Cancels all requests. Returns
- ZX_ERR_IO_NOT_PRESENT: If device is not running, disconnected, or inactive.
- ZX_ERR_IO: If cancel failed due to an unsuccessful request.
Trait Implementations§
Source§impl Clone for EndpointProxy
impl Clone for EndpointProxy
Source§fn clone(&self) -> EndpointProxy
fn clone(&self) -> EndpointProxy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EndpointProxy
impl Debug for EndpointProxy
Source§impl EndpointProxyInterface for EndpointProxy
impl EndpointProxyInterface for EndpointProxy
type GetInfoResponseFut = QueryResponseFut<Result<EndpointInfo, i32>>
type RegisterVmosResponseFut = QueryResponseFut<Vec<VmoHandle>>
type UnregisterVmosResponseFut = QueryResponseFut<(Vec<u64>, Vec<i32>)>
type CancelAllResponseFut = QueryResponseFut<Result<(), i32>>
fn get_info(&self) -> Self::GetInfoResponseFut
fn register_vmos(&self, vmo_ids: &[VmoInfo]) -> Self::RegisterVmosResponseFut
fn unregister_vmos(&self, vmo_ids: &[u64]) -> Self::UnregisterVmosResponseFut
fn queue_requests(&self, req: Vec<Request>) -> Result<(), Error>
fn cancel_all(&self) -> Self::CancelAllResponseFut
Source§impl Proxy for EndpointProxy
impl Proxy for EndpointProxy
Source§type Protocol = EndpointMarker
type Protocol = EndpointMarker
Proxy controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
Source§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Source§fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
PEER_CLOSED signal.