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. | |
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.
| 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
| udc | The USB Device Controller. | |
| iface | The interface to be disabled. |
| 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.
| udc | The USB Device Controller. | |
| iface | The interface to be enabled. | |
| setting | The alternate setting to be enabled. |
| STATUS_OK | The interface was successfully enabled. | |
| negative | The interface could not be enabled. |
| 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.
| iface | The interface which queued the data. | |
| req | The USB request used for sending the descriptors |
| status_t(* udm_interface::get_iface_descriptor)(struct udm_interface *iface, struct usb_request *req, enum usb_device_speed speed, uint16_t len) |
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.
| 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. |
| 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.
| udc | The USB Device Controller. | |
| iface | The interface which the request is for. | |
| req | The SETUP packet. |
| STATUS_OK | The control request was successfully handled. | |
| negative | The control request was not handled, and the default control endpoint should be halted. |
1.6.3