usb_pipe_t Struct Reference
[USB library for device drivers]

Abstraction of a logical connection to USB device endpoint. More...

#include <pipes.h>


Data Fields

bool auto_reset_halt
 Whether to automatically reset halt on the endpoint.
usb_direction_t direction
 Endpoint direction.
usb_endpoint_t endpoint_no
 Endpoint number.
fibril_mutex_t guard
 Guard of the whole pipe.
int hc_phone
 Phone to the host controller.
fibril_mutex_t hc_phone_mutex
 Guard for serialization of requests over the phone.
size_t max_packet_size
 Maximum packet size for the endpoint.
int refcount
 Number of active transfers over the pipe.
int refcount_soft
 Number of failed attempts to open the HC phone.
usb_transfer_type_t transfer_type
 Endpoint transfer type.
usb_device_connection_twire
 The connection used for sending the data.


Detailed Description

Abstraction of a logical connection to USB device endpoint.

It encapsulates endpoint attributes (transfer type etc.) as well as information about currently running sessions. This endpoint must be bound with existing usb_device_connection_t (i.e. the wire to send data over).

Locking order: if you want to lock both mutexes (guard and hc_phone_mutex), lock guard first. It is not necessary to lock guard if you want to lock hc_phone_mutex only.

Definition at line 68 of file pipes.h.


Field Documentation

bool auto_reset_halt

Whether to automatically reset halt on the endpoint.

Valid only for control endpoint zero.

Definition at line 119 of file pipes.h.

int hc_phone

Phone to the host controller.

Negative when no session is active. It is an error to access this member without hc_phone_mutex being locked. If call over the phone is to be made, it must be preceeded by call to pipe_add_ref() [internal libusb function].

Definition at line 94 of file pipes.h.

int refcount_soft

Number of failed attempts to open the HC phone.

When user requests usb_pipe_start_long_transfer() and the operation fails, there is no way to report this to the user. That the soft reference counter is increased to record the attempt. When the user then request e.g. usb_pipe_read(), it will try to add reference as well. If that fails, it is reported to the user. If it is okay, the real reference counter is incremented. The problem might arise when ending the long transfer (since the number of references would be only 1, but logically it shall be two). Decrementing the soft counter first shall solve this.

Definition at line 114 of file pipes.h.


The documentation for this struct was generated from the following file:
Generated on Thu Jun 2 07:46:01 2011 for HelenOS/USB by  doxygen 1.4.7