udm_interface Struct Reference
[USB Device Multiplexer (UDM)]

A USB device interface. More...

#include <dev_mux.h>

Data Fields

status_t(* enable )(struct udc *udc, struct udm_interface *iface, uint16_t setting)
 Enable the interface.
void(* disable )(struct udc *udc, struct udm_interface *iface)
 Disable the interface.
status_t(* setup )(struct udc *udc, struct udm_interface *iface, struct usb_setup_req *req)
 Handle a control request directed at an interface.
status_t(* get_iface_descriptor )(struct udm_interface *iface, struct usb_request *req, enum usb_device_speed speed, uint16_t len)
 Get the interface descriptor.
void(* free_descriptor )(struct udm_interface *iface, struct usb_request *req)
 Free any data allocated by get_iface_descriptor().
uint8_t iface_number
 The interface number identifying this interface.
uint8_t cur_setting
 The current setting of this interface.

Detailed Description

A USB device interface.

The interface driver may assume that the callbacks within this structure are never called concurrently with each other. However, they may be called concurrently with callbacks from other USB requests.

Definition at line 60 of file dev_mux.h.


Field Documentation

The current setting of this interface.

Definition at line 172 of file dev_mux.h.

void(* udm_interface::disable)(struct udc *udc, struct udm_interface *iface)

Disable the interface.

This function is called when this interface is currently active, and

  • the host selects any configuration through a Set Configuration request, or
  • the host issues a USB reset, or
  • the device is detached from the host (i.e. Vbus is no longer present)
Parameters:
udc The USB Device Controller.
iface The interface to be disabled.

Definition at line 103 of file dev_mux.h.

status_t(* udm_interface::enable)(struct udc *udc, struct udm_interface *iface, uint16_t setting)

Enable the interface.

This function is called when the host selects a configuration to which this interface belongs through a Set Configuration request, and when the host selects an alternate setting of this interface through a Set Interface request.

If setting is not valid for this interface, this function must return ERR_INVALID_ARG without causing any changes to the internal state.

If the interface is already enabled, the interface must disable and re-enable itself, possibly with a new alternate setting.

This function must also update usb_dev_iface::cur_setting upon success.

Parameters:
udc The USB Device Controller.
iface The interface to be enabled.
setting The alternate setting to be enabled.
Return values:
STATUS_OK The interface was successfully enabled.
negative The interface could not be enabled.

Definition at line 87 of file dev_mux.h.

void(* udm_interface::free_descriptor)(struct udm_interface *iface, struct usb_request *req)

Free any data allocated by get_iface_descriptor().

When all descriptors have been successfully sent to the host, the device multiplexer will call free_descriptor() on each interface in the same order that get_descriptor() was called when preparing the request. Each interface must remove the same number of buffers that it queued during get_descriptor() from the head of the request's buffer list and free the buffer and any data associated with it.

If the request's buffer list becomes empty, this function won't be called, as it indicates that the interface didn't queue any buffers.

Parameters:
iface The interface which queued the data.
req The USB request used for sending the descriptors

Definition at line 166 of file dev_mux.h.

Get the interface descriptor.

This function must queue interface descriptors for all alternate settings, along with any associated endpoint descriptors and other interface-specific descriptors, as long as the total number of bytes queued doesn't exceed len.

If some descriptors, or parts of them, cannot be queued because the total size of the buffers would exceed len, this does not affect the return value.

Parameters:
iface The interface for which to retrieve the descriptor.
req The USB request used for sending the descriptors
speed The current USB bus speed
len The maximum number of bytes to be queued, excluding everything that has been already queued to req. Note that len may be zero.
Returns:
The total size of the descriptors in bytes, not limited by len, or a negative error code on failure.

Definition at line 144 of file dev_mux.h.

The interface number identifying this interface.

Definition at line 170 of file dev_mux.h.

status_t(* udm_interface::setup)(struct udc *udc, struct udm_interface *iface, struct usb_setup_req *req)

Handle a control request directed at an interface.

This function is called when this interface is currently active and the host sends a vendor- or class-specific SETUP request with this interface as the recipient.

Parameters:
udc The USB Device Controller.
iface The interface which the request is for.
req The SETUP packet.
Return values:
STATUS_OK The control request was successfully handled.
negative The control request was not handled, and the default control endpoint should be halted.

Definition at line 119 of file dev_mux.h.


The documentation for this struct was generated from the following file:
Generated on Thu Apr 29 14:10:36 2010 for xplain-bc by  doxygen 1.6.3