FreeBSD kernel usb device Code
|
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usb_ioctl.h>
#include "usbdevs.h"
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_transfer.h>
#include <dev/usb/usb_request.h>
#include <dev/usb/usb_dynamic.h>
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/usb_msctest.h>
#include <dev/usb/quirk/usb_quirk.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR usb_debug |
Functions | |
static int | sysctl_hw_usb_template (SYSCTL_HANDLER_ARGS) |
static void | usb_init_endpoint (struct usb_device *, uint8_t, struct usb_endpoint_descriptor *, struct usb_endpoint_ss_comp_descriptor *, struct usb_endpoint *) |
static void | usb_unconfigure (struct usb_device *, uint8_t) |
static void | usb_detach_device_sub (struct usb_device *, device_t *, char **, uint8_t) |
static uint8_t | usb_probe_and_attach_sub (struct usb_device *, struct usb_attach_arg *) |
static void | usb_init_attach_arg (struct usb_device *, struct usb_attach_arg *) |
static void | usb_suspend_resume_sub (struct usb_device *, device_t, uint8_t) |
static usb_error_t | usb_config_parse (struct usb_device *, uint8_t, uint8_t) |
SYSCTL_PROC (_hw_usb, OID_AUTO, template, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_usb_template, "I", "Selected USB device side template") | |
static void | usb_trigger_reprobe_on_off (int on_not_off) |
static void | usb_trigger_reprobe_all (void) |
SYSCTL_INT (_hw_usb, OID_AUTO, usb_lang_id, CTLFLAG_RWTUN, &usb_lang_id, 0, "Preferred USB language ID") | |
SYSCTL_INT (_hw_usb, OID_AUTO, usb_lang_mask, CTLFLAG_RWTUN, &usb_lang_mask, 0, "Preferred USB language mask") | |
const char * | usb_statestr (enum usb_dev_state state) |
const char * | usb_get_manufacturer (struct usb_device *udev) |
const char * | usb_get_product (struct usb_device *udev) |
const char * | usb_get_serial (struct usb_device *udev) |
struct usb_endpoint * | usbd_get_ep_by_addr (struct usb_device *udev, uint8_t ea_val) |
struct usb_endpoint * | usbd_get_endpoint (struct usb_device *udev, uint8_t iface_index, const struct usb_config *setup) |
usb_error_t | usbd_interface_count (struct usb_device *udev, uint8_t *count) |
struct usb_endpoint * | usb_endpoint_foreach (struct usb_device *udev, struct usb_endpoint *ep) |
static void | usb_wait_pending_refs (struct usb_device *udev) |
usb_error_t | usbd_set_config_index (struct usb_device *udev, uint8_t index) |
usb_error_t | usbd_set_alt_interface_index (struct usb_device *udev, uint8_t iface_index, uint8_t alt_index) |
usb_error_t | usbd_set_endpoint_stall (struct usb_device *udev, struct usb_endpoint *ep, uint8_t do_stall) |
usb_error_t | usb_reset_iface_endpoints (struct usb_device *udev, uint8_t iface_index) |
void | usb_detach_device (struct usb_device *udev, uint8_t iface_index, uint8_t flag) |
void | usbd_set_parent_iface (struct usb_device *udev, uint8_t iface_index, uint8_t parent_index) |
usb_error_t | usb_probe_and_attach (struct usb_device *udev, uint8_t iface_index) |
usb_error_t | usb_suspend_resume (struct usb_device *udev, uint8_t do_suspend) |
static void | usbd_clear_stall_proc (struct usb_proc_msg *_pm) |
void | usb_get_langid (struct usb_device *udev) |
struct usb_device * | usb_alloc_device (device_t parent_dev, struct usb_bus *bus, struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode) |
void | usb_free_device (struct usb_device *udev, uint8_t flag) |
struct usb_interface * | usbd_get_iface (struct usb_device *udev, uint8_t iface_index) |
void * | usbd_find_descriptor (struct usb_device *udev, void *id, uint8_t iface_index, uint8_t type, uint8_t type_mask, uint8_t subtype, uint8_t subtype_mask) |
void | usb_devinfo (struct usb_device *udev, char *dst_ptr, uint16_t dst_len) |
void | usb_set_device_strings (struct usb_device *udev) |
enum usb_hc_mode | usbd_get_mode (struct usb_device *udev) |
enum usb_dev_speed | usbd_get_speed (struct usb_device *udev) |
uint32_t | usbd_get_isoc_fps (struct usb_device *udev) |
struct usb_device_descriptor * | usbd_get_device_descriptor (struct usb_device *udev) |
struct usb_config_descriptor * | usbd_get_config_descriptor (struct usb_device *udev) |
uint8_t | usb_test_quirk (const struct usb_attach_arg *uaa, uint16_t quirk) |
struct usb_interface_descriptor * | usbd_get_interface_descriptor (struct usb_interface *iface) |
uint8_t | usbd_get_interface_altindex (struct usb_interface *iface) |
uint8_t | usbd_get_bus_index (struct usb_device *udev) |
uint8_t | usbd_get_device_index (struct usb_device *udev) |
uint8_t | usb_peer_can_wakeup (struct usb_device *udev) |
void | usb_set_device_state (struct usb_device *udev, enum usb_dev_state state) |
enum usb_dev_state | usb_get_device_state (struct usb_device *udev) |
uint8_t | usbd_device_attached (struct usb_device *udev) |
uint8_t | usbd_enum_lock (struct usb_device *udev) |
void | usbd_enum_unlock (struct usb_device *udev) |
void | usbd_sr_lock (struct usb_device *udev) |
void | usbd_sr_unlock (struct usb_device *udev) |
uint8_t | usbd_enum_is_locked (struct usb_device *udev) |
uint8_t | usbd_ctrl_lock (struct usb_device *udev) |
void | usbd_ctrl_unlock (struct usb_device *udev) |
usb_error_t | usbd_set_pnpinfo (struct usb_device *udev, uint8_t iface_index, const char *pnpinfo) |
usb_error_t | usbd_add_dynamic_quirk (struct usb_device *udev, uint16_t quirk) |
usb_error_t | usbd_set_endpoint_mode (struct usb_device *udev, struct usb_endpoint *ep, uint8_t ep_mode) |
uint8_t | usbd_get_endpoint_mode (struct usb_device *udev, struct usb_endpoint *ep) |
Variables | |
static usb_proc_callback_t | usbd_clear_stall_proc |
int | usb_template = -1 |
static int | usb_lang_id = 0x0009 |
static int | usb_lang_mask = 0x00FF |
static const char * | statestr [USB_STATE_MAX] |
#define USB_DEBUG_VAR usb_debug |
Definition at line 64 of file usb_device.c.
|
static |
Definition at line 235 of file usb_device.c.
References error, req, usb_template, usb_trigger_reprobe_all(), usb_trigger_reprobe_on_off(), and val.
SYSCTL_INT | ( | _hw_usb | , |
OID_AUTO | , | ||
usb_lang_id | , | ||
CTLFLAG_RWTUN | , | ||
& | usb_lang_id, | ||
0 | , | ||
"Preferred USB language ID" | |||
) |
SYSCTL_INT | ( | _hw_usb | , |
OID_AUTO | , | ||
usb_lang_mask | , | ||
CTLFLAG_RWTUN | , | ||
& | usb_lang_mask, | ||
0 | , | ||
"Preferred USB language mask" | |||
) |
SYSCTL_PROC | ( | _hw_usb | , |
OID_AUTO | , | ||
template | , | ||
CTLTYPE_INT|CTLFLAG_RWTUN| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_hw_usb_template | , | ||
"I" | , | ||
"Selected USB device side template" | |||
) |
struct usb_device * usb_alloc_device | ( | device_t | parent_dev, |
struct usb_bus * | bus, | ||
struct usb_device * | parent_hub, | ||
uint8_t | depth, | ||
uint8_t | port_index, | ||
uint8_t | port_no, | ||
enum usb_dev_speed | speed, | ||
enum usb_hc_mode | mode | ||
) |
Definition at line 1737 of file usb_device.c.
References usb_device::address, usb_endpoint_descriptor::bDescriptorType, usb_endpoint_ss_comp_descriptor::bDescriptorType, usb_bus::bdev, usb_endpoint_descriptor::bEndpointAddress, usb_endpoint_descriptor::bInterval, usb_endpoint_descriptor::bLength, usb_endpoint_ss_comp_descriptor::bLength, usb_endpoint_descriptor::bmAttributes, usb_device_descriptor::bMaxPacketSize, usb_device_descriptor::bNumConfigurations, usb_config_descriptor::bNumInterface, usb_device::bus, usb_device::cdesc, usb_device::cs_msg, usb_device::ctrl_ep, usb_device::ctrl_ep_comp_desc, usb_device::ctrl_ep_desc, usb_device::ctrl_sx, usb_device::ctrlreq_cv, usb_device::curr_config_index, usb_device::curr_config_no, usb_device::ddesc, usb_device::depth, usb_device::device_index, usb_bus_methods::device_init, usb_device::device_mtx, usb_bus::devices, usb_bus::devices_max, DPRINTF, usb_device::enum_sx, usb_device::flags, usb_udev_msg::hdr, usb_device::hs_hub_addr, usb_device::hs_port_no, usb_device::hub, usb_power_save::last_xfer_time, usb_bus::methods, usb_device_flags::no_strings, usb_device::parent_dev, usb_device::parent_hs_hub, usb_device::parent_hub, usb_device::plugtime, usb_proc_msg::pm_callback, usb_device::port_index, usb_device::port_no, usb_hub::ports, usb_device::power, usb_device::power_mode, usb_device::pwr_save, usb_device::ref_cv, usb_device::refcount, usb_device_flags::self_powered, usb_device::speed, usb_device::sr_sx, UDESC_ENDPOINT, UDESC_ENDPOINT_SS_COMP, usb_udev_msg::udev, UE_CONTROL, UQ_BUS_POWERED, usb_device_flags::uq_bus_powered, UQ_CFG_INDEX_0, UQ_CFG_INDEX_1, UQ_CFG_INDEX_2, UQ_CFG_INDEX_3, UQ_CFG_INDEX_4, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_PREVENT_ALLOW, UQ_MSC_NO_START_STOP, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_NO_STRINGS, usb_alloc_symlink(), usb_bus_port_set_device(), USB_CONTROL_ENDPOINT, usb_free_device(), USB_GENERIC_NAME, usb_get_langid(), usb_get_manufacturer(), usb_get_product(), usb_iface_is_cdrom(), usb_init_attach_arg(), usb_init_endpoint(), USB_MAX_IPACKET, USB_MIN_POWER, usb_device_flags::usb_mode, USB_MODE_DEVICE, USB_MODE_HOST, usb_msc_auto_quirk(), USB_POWER_MODE_ON, USB_ROOT_HUB_ADDR, usb_set_device_state(), usb_set_device_strings(), USB_SPEED_HIGH, USB_START_ADDR, USB_STATE_ADDRESSED, USB_STATE_POWERED, usb_temp_setup_by_index_p, usb_template, usb_test_quirk(), USB_UNCONFIG_INDEX, USB_UNCONFIG_NO, usbd_clear_stall_proc, usbd_errstr(), usbd_filter_power_mode(), usbd_get_no_descriptors(), usbd_req_re_enumerate(), usbd_req_set_address(), usbd_set_config_index(), usbd_setup_device_desc(), and usb_endpoint_descriptor::wMaxPacketSize.
Referenced by uhub_reattach_port(), and usb_bus_attach().
|
static |
Definition at line 816 of file usb_device.c.
References usb_interface::alt_index, usb_device::bus, usb_device::cdesc, DPRINTF, usb_device::endpoints, usb_device::endpoints_max, usb_device::enum_sx, usb_device::ep_curr, id, usb_interface::idesc, usb_endpoint::iface_index, usb_idesc_parse_state::iface_index, usb_idesc_parse_state::iface_index_alt, usb_device::ifaces, usb_device::ifaces_max, usb_interface::num_altsetting, usb_interface::parent_iface_index, usb_endpoint::refcount_alloc, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_CFG_ALLOC, USB_CFG_FREE, USB_CFG_INIT, usb_ed_comp_foreach(), usb_edesc_foreach(), USB_ERR_IN_USE, USB_ERR_NOMEM, usb_idesc_foreach(), USB_IFACE_INDEX_ANY, usb_init_endpoint(), and USB_MAX_EP_UNITS.
Referenced by usb_unconfigure(), usbd_set_alt_interface_index(), and usbd_set_config_index().
void usb_detach_device | ( | struct usb_device * | udev, |
uint8_t | iface_index, | ||
uint8_t | flag | ||
) |
Definition at line 1264 of file usb_device.c.
References usb_device::enum_sx, usb_interface::pnpinfo, usb_interface::subdev, usb_detach_device_sub(), USB_IFACE_INDEX_ANY, USB_IFACE_MAX, and usbd_get_iface().
Referenced by bbb_attach(), and usb_unconfigure().
|
static |
Definition at line 1206 of file usb_device.c.
References usb_device::address, dev, error, usb_device::flags, usb_device::parent_dev, usb_device_flags::peer_suspended, and usb_device::port_no.
Referenced by usb_detach_device().
void usb_devinfo | ( | struct usb_device * | udev, |
char * | dst_ptr, | ||
uint16_t | dst_len | ||
) |
Definition at line 2440 of file usb_device.c.
References usb_device::address, usb_device_descriptor::bcdDevice, usb_device_descriptor::bcdUSB, usb_device_descriptor::bDeviceClass, usb_device_descriptor::bDeviceSubClass, usb_device::ddesc, UGETW, usb_get_manufacturer(), and usb_get_product().
Referenced by device_set_usb_desc().
struct usb_endpoint * usb_endpoint_foreach | ( | struct usb_device * | udev, |
struct usb_endpoint * | ep | ||
) |
Definition at line 555 of file usb_device.c.
References usb_endpoint::edesc, usb_device::endpoints, and usb_device::endpoints_max.
void usb_free_device | ( | struct usb_device * | udev, |
uint8_t | flag | ||
) |
Definition at line 2271 of file usb_device.c.
References usb_device::bus, bus, usb_device::cs_msg, usb_device::ctrl_sx, usb_device::ctrl_xfer, usb_device::ctrlreq_cv, usb_device::device_mtx, usb_device::enum_sx, usb_device::flags, usb_device::hub, usb_device::manufacturer, usb_device::parent_hub, usb_device::port_index, usb_device::port_no, usb_hub::ports, usb_device::product, usb_device::ref_cv, usb_device::serial, usb_device::sr_sx, USB_BUS_CS_PROC, USB_BUS_LOCK, usb_bus_port_set_device(), USB_BUS_UNLOCK, USB_CTRL_XFER_MAX, usb_free_symlink(), usb_get_manufacturer(), usb_get_product(), usb_device_flags::usb_mode, USB_MODE_DEVICE, usb_proc_mwait(), USB_ROOT_HUB_ADDR, usb_set_device_state(), USB_STATE_DETACHED, usb_temp_unsetup_p, USB_UNCFG_FLAG_FREE_EP0, usb_unconfigure(), usb_wait_pending_refs(), and usbd_transfer_unsetup().
Referenced by uhub_detach(), uhub_reattach_port(), usb_alloc_device(), and usb_bus_detach().
enum usb_dev_state usb_get_device_state | ( | struct usb_device * | udev | ) |
Definition at line 2877 of file usb_device.c.
References usb_device::state, and USB_STATE_DETACHED.
Referenced by xhci_device_state_change().
void usb_get_langid | ( | struct usb_device * | udev | ) |
Definition at line 1651 of file usb_device.c.
References usb_device_scratch::data, usb_device::ddesc, usb_device::flags, usb_device_descriptor::iManufacturer, usb_device_descriptor::iProduct, usb_device_descriptor::iSerialNumber, usb_device::langid, usb_device_flags::no_strings, usb_device::scratch, UGETW, USB_ERR_INVAL, usb_lang_id, usb_lang_mask, USB_LANGUAGE_TABLE, usbd_ctrl_lock(), usbd_ctrl_unlock(), and usbd_req_get_string_desc().
Referenced by uhub_explore_handle_re_enumerate(), and usb_alloc_device().
const char * usb_get_manufacturer | ( | struct usb_device * | udev | ) |
Definition at line 281 of file usb_device.c.
References usb_device::manufacturer.
Referenced by u3g_test_autoinst(), ubser_probe(), uhso_attach(), usb_alloc_device(), usb_devinfo(), usb_free_device(), usbhid_fill_device_info(), and usie_autoinst().
const char * usb_get_product | ( | struct usb_device * | udev | ) |
Definition at line 287 of file usb_device.c.
References usb_device::product.
Referenced by is_jtag_interface(), u3g_test_autoinst(), uftdi_probe(), uhso_attach(), usb_alloc_device(), usb_devinfo(), usb_free_device(), usbhid_fill_device_info(), and usie_autoinst().
const char * usb_get_serial | ( | struct usb_device * | udev | ) |
Definition at line 293 of file usb_device.c.
References usb_device::serial.
Referenced by udl_select_chip(), uep_attach(), uhub_child_pnpinfo(), ukbd_attach(), umass_cam_action(), umass_cam_cb(), ums_attach(), usbhid_fill_device_info(), wmt_attach(), and wsp_attach().
|
static |
Definition at line 1410 of file usb_device.c.
References usb_device_descriptor::bcdDevice, usbd_lookup_info::bcdDevice, usbd_lookup_info::bConfigIndex, usbd_lookup_info::bConfigNum, usb_device_descriptor::bDeviceClass, usbd_lookup_info::bDeviceClass, usb_device_descriptor::bDeviceProtocol, usbd_lookup_info::bDeviceProtocol, usb_device_descriptor::bDeviceSubClass, usbd_lookup_info::bDeviceSubClass, usb_device::curr_config_index, usb_device::curr_config_no, usb_device::ddesc, usb_attach_arg::dev_state, usb_attach_arg::device, usb_device::flags, usb_device_descriptor::idProduct, usbd_lookup_info::idProduct, usb_device_descriptor::idVendor, usbd_lookup_info::idVendor, usb_attach_arg::info, usb_attach_arg::port, usb_device::port_no, UAA_DEV_READY, UGETW, usb_device_flags::usb_mode, and usb_attach_arg::usb_mode.
Referenced by usb_alloc_device(), and usb_probe_and_attach().
|
static |
Definition at line 500 of file usb_device.c.
References usb_endpoint_descriptor::bmAttributes, usb_endpoint_ss_comp_descriptor::bmAttributes, usb_device::bus, usb_bus_methods::clear_stall, usb_xfer_queue::command, usb_endpoint::ecomp, usb_endpoint::edesc, usb_bus_methods::endpoint_init, usb_endpoint::endpoint_q, usb_endpoint::iface_index, usb_bus::methods, usb_endpoint::methods, usb_device::speed, UE_BULK, UE_GET_BULK_STREAMS, UE_XFERTYPE, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_EP_MODE_DEFAULT, USB_EP_MODE_STREAMS, USB_MAX_EP_STREAMS, USB_SPEED_SUPER, usbd_pipe_start(), and usbd_set_endpoint_mode().
Referenced by usb_alloc_device(), and usb_config_parse().
uint8_t usb_peer_can_wakeup | ( | struct usb_device * | udev | ) |
Definition at line 2845 of file usb_device.c.
References usb_config_descriptor::bmAttributes, usb_device::cdesc, usb_device::flags, UC_REMOTE_WAKEUP, usb_device_flags::usb_mode, and USB_MODE_HOST.
Referenced by usb_dev_resume_peer(), usb_dev_suspend_peer(), and usb_peer_should_wakeup().
usb_error_t usb_probe_and_attach | ( | struct usb_device * | udev, |
uint8_t | iface_index | ||
) |
Definition at line 1441 of file usb_device.c.
References usbd_lookup_info::bIfaceIndex, usbd_lookup_info::bIfaceNum, usb_interface_descriptor::bInterfaceClass, usbd_lookup_info::bInterfaceClass, usb_interface_descriptor::bInterfaceNumber, usb_interface_descriptor::bInterfaceProtocol, usbd_lookup_info::bInterfaceProtocol, usb_interface_descriptor::bInterfaceSubClass, usbd_lookup_info::bInterfaceSubClass, usb_device::curr_config_index, usb_attach_arg::dev_state, DPRINTF, usb_attach_arg::driver_info, usb_interface::idesc, usb_attach_arg::iface, usb_attach_arg::info, usb_device::parent_dev, usb_attach_arg::temp_dev, UAA_DEV_EJECTING, UAA_DEV_READY, UQ_MSC_DYMO_EJECT, usb_dymo_eject(), USB_ERR_INVAL, USB_IFACE_INDEX_ANY, USB_IFACE_MAX, usb_init_attach_arg(), usb_probe_and_attach_sub(), usb_test_quirk(), USB_UNCONFIG_INDEX, usb_unconfigure(), usbd_enum_lock(), usbd_enum_unlock(), and usbd_get_iface().
Referenced by uhub_explore_handle_re_enumerate(), uhub_explore_sub(), usb_bus_attach(), usb_bus_resume(), and usb_handle_set_config().
|
static |
Definition at line 1313 of file usb_device.c.
References dev, usb_device::flags, usb_attach_arg::iface, usb_device::parent_dev, usb_interface::parent_iface_index, usb_device_flags::peer_suspended, usb_interface::subdev, usb_attach_arg::temp_dev, and USB_IFACE_INDEX_ANY.
Referenced by usb_probe_and_attach().
usb_error_t usb_reset_iface_endpoints | ( | struct usb_device * | udev, |
uint8_t | iface_index | ||
) |
Definition at line 1178 of file usb_device.c.
References usb_endpoint::edesc, usb_device::endpoints, usb_device::endpoints_max, usb_endpoint::iface_index, and usbd_set_endpoint_stall().
Referenced by usb_handle_iface_request().
void usb_set_device_state | ( | struct usb_device * | udev, |
enum usb_dev_state | state | ||
) |
Definition at line 2857 of file usb_device.c.
References usb_device::bus, usb_bus_methods::device_state_change, DPRINTF, usb_bus::methods, usb_device::state, state, usb_ref_lock, USB_STATE_MAX, and usb_statestr().
Referenced by usb_alloc_device(), usb_free_device(), usbd_req_re_enumerate(), and usbd_set_config_index().
void usb_set_device_strings | ( | struct usb_device * | udev | ) |
Definition at line 2488 of file usb_device.c.
References usb_device_scratch::data, usb_device::ddesc, usb_device_descriptor::idProduct, usb_device_descriptor::idVendor, usb_device_descriptor::iManufacturer, usb_device_descriptor::iProduct, usb_device_descriptor::iSerialNumber, usb_device::manufacturer, usb_device::product, usb_device::scratch, usb_device::serial, UGETW, usb_trim_spaces(), usbd_ctrl_lock(), usbd_ctrl_unlock(), and usbd_req_get_string_any().
Referenced by uhub_explore_handle_re_enumerate(), and usb_alloc_device().
const char * usb_statestr | ( | enum usb_dev_state | state | ) |
Definition at line 275 of file usb_device.c.
References usb_device::state, statestr, and USB_STATE_MAX.
Referenced by usb_set_device_state().
usb_error_t usb_suspend_resume | ( | struct usb_device * | udev, |
uint8_t | do_suspend | ||
) |
Definition at line 1586 of file usb_device.c.
References usb_device::bus, usb_device::flags, usb_device_flags::peer_suspended, usb_device::sr_sx, usb_interface::subdev, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_IFACE_MAX, usb_suspend_resume_sub(), and usbd_get_iface().
Referenced by usb_dev_resume_peer(), and usb_dev_suspend_peer().
|
static |
Definition at line 1555 of file usb_device.c.
References dev.
Referenced by usb_suspend_resume().
uint8_t usb_test_quirk | ( | const struct usb_attach_arg * | uaa, |
uint16_t | quirk | ||
) |
Definition at line 2631 of file usb_device.c.
References usb_device::autoQuirk, usb_attach_arg::device, usb_attach_arg::info, UQ_NONE, USB_MAX_AUTO_QUIRK, and usb_test_quirk_p.
Referenced by u3g_attach(), u3g_test_autoinst(), uhid_probe(), ukbd_attach(), ukbd_probe(), umass_probe_proto(), umodem_attach(), ums_attach(), ums_probe(), usb_alloc_device(), usb_msc_auto_quirk(), usb_probe_and_attach(), usbhid_probe(), and wmt_probe().
|
static |
Definition at line 215 of file usb_device.c.
References USB_MS_TO_TICKS, usb_pause_mtx(), USB_POWER_DOWN_TIME, and usb_trigger_reprobe_on_off().
Referenced by sysctl_hw_usb_template().
|
static |
Definition at line 136 of file usb_device.c.
References usb_device::bus, bus, usb_bus::devices, DPRINTF, next, usb_device::ref_cv, usb_device::refcount, UGETW, UHF_PORT_POWER, UPS_PORT_MODE_DEVICE, USB_DEV_REF_MAX, usb_devclass_ptr, usb_ref_lock, USB_ROOT_HUB_ADDR, usbd_enum_lock(), usbd_enum_unlock(), usbd_errstr(), usbd_req_clear_port_feature(), usbd_req_get_port_status(), usbd_req_set_port_feature(), and usb_port_status::wPortStatus.
Referenced by sysctl_hw_usb_template(), and usb_trigger_reprobe_all().
|
static |
Definition at line 616 of file usb_device.c.
References usb_device::cdesc, usb_device::curr_config_index, usb_device::curr_config_no, usb_device::flags, USB_CFG_FREE, usb_config_parse(), usb_detach_device(), USB_IFACE_INDEX_ANY, usb_linux_free_device_p, usb_device_flags::usb_mode, USB_MODE_DEVICE, USB_UNCONFIG_INDEX, USB_UNCONFIG_NO, usbd_enum_lock(), usbd_enum_unlock(), and usbd_free_config_desc().
Referenced by usb_free_device(), usb_probe_and_attach(), and usbd_set_config_index().
|
static |
Definition at line 587 of file usb_device.c.
References DPRINTF, usb_device::ref_cv, usb_device::refcount, USB_DEV_REF_MAX, and usb_ref_lock.
Referenced by usb_free_device().
usb_error_t usbd_add_dynamic_quirk | ( | struct usb_device * | udev, |
uint16_t | quirk | ||
) |
Definition at line 3045 of file usb_device.c.
References usb_device::autoQuirk, USB_ERR_NOMEM, and USB_MAX_AUTO_QUIRK.
|
static |
Definition at line 1628 of file usb_device.c.
References usb_device::bus, usb_device::ctrl_xfer, usb_device::device_mtx, usb_udev_msg::udev, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_MTX_LOCK, USB_MTX_UNLOCK, and usbd_transfer_start().
uint8_t usbd_ctrl_lock | ( | struct usb_device * | udev | ) |
Definition at line 2983 of file usb_device.c.
References usb_device::ctrl_sx, usbd_enum_is_locked(), and usbd_sr_unlock().
Referenced by device_set_usb_desc(), uhub_child_pnpinfo(), usb_get_langid(), usb_set_device_strings(), usb_temp_setup(), usbd_do_request_flags(), and usbd_transfer_setup().
void usbd_ctrl_unlock | ( | struct usb_device * | udev | ) |
Definition at line 2999 of file usb_device.c.
References usb_device::ctrl_sx, usbd_enum_is_locked(), and usbd_sr_lock().
Referenced by device_set_usb_desc(), uhub_child_pnpinfo(), usb_get_langid(), usb_set_device_strings(), usb_temp_setup(), usbd_do_request_flags(), and usbd_transfer_setup().
uint8_t usbd_device_attached | ( | struct usb_device * | udev | ) |
Definition at line 2885 of file usb_device.c.
References usb_device::state, and USB_STATE_DETACHED.
uint8_t usbd_enum_is_locked | ( | struct usb_device * | udev | ) |
Definition at line 2972 of file usb_device.c.
References usb_device::enum_sx.
Referenced by usbd_ctrl_lock(), and usbd_ctrl_unlock().
uint8_t usbd_enum_lock | ( | struct usb_device * | udev | ) |
Definition at line 2896 of file usb_device.c.
References usb_device::enum_sx, and usb_device::sr_sx.
Referenced by bbb_attach(), uhub_explore(), uhub_explore_handle_re_enumerate(), usb_bus_resume(), usb_bus_shutdown(), usb_bus_suspend(), usb_check_alt_setting(), usb_handle_iface_request(), usb_handle_set_config(), usb_probe_and_attach(), usb_trigger_reprobe_on_off(), usb_unconfigure(), usbd_set_alt_interface_index(), usbd_set_config_index(), and usbd_set_endpoint_mode().
void usbd_enum_unlock | ( | struct usb_device * | udev | ) |
Definition at line 2936 of file usb_device.c.
References usb_device::enum_sx, and usb_device::sr_sx.
Referenced by bbb_attach(), uhub_explore(), uhub_explore_handle_re_enumerate(), usb_bus_resume(), usb_bus_shutdown(), usb_bus_suspend(), usb_check_alt_setting(), usb_handle_iface_request(), usb_handle_set_config(), usb_probe_and_attach(), usb_trigger_reprobe_on_off(), usb_unconfigure(), usbd_set_alt_interface_index(), usbd_set_config_index(), and usbd_set_endpoint_mode().
void * usbd_find_descriptor | ( | struct usb_device * | udev, |
void * | id, | ||
uint8_t | iface_index, | ||
uint8_t | type, | ||
uint8_t | type_mask, | ||
uint8_t | subtype, | ||
uint8_t | subtype_mask | ||
) |
Definition at line 2395 of file usb_device.c.
References usb_endpoint_descriptor::bDescriptorType, desc, type, UDESC_INTERFACE, usb_desc_foreach(), usbd_get_config_descriptor(), usbd_get_iface(), and usbd_get_interface_descriptor().
Referenced by cdce_attach(), uhso_attach_muxserial(), umodem_attach(), umodem_get_desc(), and urndis_attach().
uint8_t usbd_get_bus_index | ( | struct usb_device * | udev | ) |
Definition at line 2668 of file usb_device.c.
References usb_bus::bdev, and usb_device::bus.
Referenced by uftdi_probe().
struct usb_config_descriptor * usbd_get_config_descriptor | ( | struct usb_device * | udev | ) |
Definition at line 2616 of file usb_device.c.
References usb_device::cdesc.
Referenced by axe_reset(), axge_reset(), kue_reset(), muge_reset(), smsc_reset(), ufoma_attach(), ufoma_modem_setup(), ufoma_probe(), uhid_snes_attach(), uhso_probe_iface_static(), ulpt_attach(), usbd_find_descriptor(), usbd_req_get_hid_desc(), usbhid_fill_device_info(), and zyd_init_locked().
struct usb_device_descriptor * usbd_get_device_descriptor | ( | struct usb_device * | udev | ) |
Definition at line 2608 of file usb_device.c.
References usb_device::ddesc.
Referenced by kue_load_fw(), uftdi_devtype_setup(), and uplcom_attach().
uint8_t usbd_get_device_index | ( | struct usb_device * | udev | ) |
Definition at line 2674 of file usb_device.c.
References usb_device::device_index.
Referenced by uftdi_probe().
struct usb_endpoint * usbd_get_endpoint | ( | struct usb_device * | udev, |
uint8_t | iface_index, | ||
const struct usb_config * | setup | ||
) |
Definition at line 362 of file usb_device.c.
References usb_endpoint_descriptor::bEndpointAddress, usb_endpoint_descriptor::bmAttributes, usb_device::ctrl_ep, usb_config::direction, usb_endpoint::edesc, usb_config::endpoint, usb_device::endpoints, usb_device::endpoints_max, usb_config::ep_index, usb_device::flags, usb_endpoint::iface_index, index, usb_config::type, UE_ADDR, UE_ADDR_ANY, UE_BULK_INTR, UE_DIR_ANY, UE_DIR_IN, UE_DIR_OUT, UE_DIR_RX, UE_DIR_TX, UE_TYPE_ANY, UE_XFERTYPE, usb_device_flags::usb_mode, usb_config::usb_mode, USB_MODE_DEVICE, and USB_MODE_DUAL.
Referenced by usbd_transfer_setup(), and usbhid_fill_device_info().
uint8_t usbd_get_endpoint_mode | ( | struct usb_device * | udev, |
struct usb_endpoint * | ep | ||
) |
Definition at line 3092 of file usb_device.c.
References usb_endpoint::ep_mode.
struct usb_endpoint * usbd_get_ep_by_addr | ( | struct usb_device * | udev, |
uint8_t | ea_val | ||
) |
Definition at line 309 of file usb_device.c.
References usb_endpoint_descriptor::bEndpointAddress, usb_device::ctrl_ep, usb_endpoint::edesc, usb_device::endpoints, usb_device::endpoints_max, UE_ADDR, UE_DIR_IN, and UE_DIR_OUT.
Referenced by usb_handle_get_stall(), and usb_handle_set_stall().
struct usb_interface * usbd_get_iface | ( | struct usb_device * | udev, |
uint8_t | iface_index | ||
) |
Definition at line 2370 of file usb_device.c.
References usb_device::ifaces, and usb_device::ifaces_max.
Referenced by bbb_attach(), cdce_attach(), cdce_test_autoinst(), rsu_attach(), run_autoinst(), u3g_attach(), u3g_test_autoinst(), ufoma_modem_setup(), ugensa_attach(), ugold_attach(), uhso_probe_iface(), uhso_test_autoinst(), uhub_child_pnpinfo(), uhub_find_iface_index(), umodem_attach(), umodem_find_data_iface(), uplcom_attach(), usb_detach_device(), usb_handle_iface_request(), usb_probe_and_attach(), usb_suspend_resume(), usbd_find_descriptor(), usbd_req_get_alt_interface_no(), usbd_req_get_hid_desc(), usbd_req_get_report(), usbd_req_get_report_descriptor(), usbd_req_set_alt_interface_no(), usbd_req_set_idle(), usbd_req_set_protocol(), usbd_req_set_report(), usbd_set_alt_interface_index(), usbd_set_parent_iface(), usbd_set_pnpinfo(), usie_attach(), usie_autoinst(), and wsp_probe().
uint8_t usbd_get_interface_altindex | ( | struct usb_interface * | iface | ) |
Definition at line 2662 of file usb_device.c.
References usb_interface::alt_index.
struct usb_interface_descriptor * usbd_get_interface_descriptor | ( | struct usb_interface * | iface | ) |
Definition at line 2654 of file usb_device.c.
References usb_interface::idesc.
Referenced by cdce_attach(), cfumass_probe(), u3g_attach(), ufoma_attach(), ufoma_modem_setup(), ufoma_probe(), uhid_snes_attach(), uhso_attach(), ulpt_attach(), umass_attach(), umass_get_proto(), umodem_attach(), umodem_find_data_iface(), uplcom_attach(), usbd_find_descriptor(), usie_attach(), ustorage_fs_attach(), and ustorage_fs_probe().
uint32_t usbd_get_isoc_fps | ( | struct usb_device * | udev | ) |
Definition at line 2595 of file usb_device.c.
References usb_device::speed, USB_SPEED_FULL, and USB_SPEED_LOW.
enum usb_hc_mode usbd_get_mode | ( | struct usb_device * | udev | ) |
Definition at line 2579 of file usb_device.c.
References usb_device::flags, and usb_device_flags::usb_mode.
Referenced by cdce_bulk_read_callback(), cdce_bulk_write_callback(), cdce_init(), cdce_intr_read_callback(), cdce_intr_write_callback(), and cdceem_init().
enum usb_dev_speed usbd_get_speed | ( | struct usb_device * | udev | ) |
Definition at line 2589 of file usb_device.c.
References usb_device::speed.
Referenced by atmegadci_setup_standard_chain(), avr32dci_setup_standard_chain(), cdce_intr_write_callback(), dwc_otg_setup_standard_chain(), ehci_setup_standard_chain(), lan78xx_chip_init(), lan78xx_miibus_statchg(), musbotg_setup_standard_chain(), ohci_setup_standard_chain(), smsc_chip_init(), uhci_setup_standard_chain(), umass_cam_action(), ure_init(), ure_rtl8152_nic_reset(), ure_rtl8153_init(), ure_rtl8153b_init(), ure_rtl8153b_nic_reset(), usb_hs_bandwidth_adjust(), usb_hs_bandwidth_alloc(), usb_hw_ep_get_needs(), usbd_transfer_setup(), usbd_xfer_get_isochronous_start_frame(), uss820dci_setup_standard_chain(), and xhci_setup_generic_chain().
usb_error_t usbd_interface_count | ( | struct usb_device * | udev, |
uint8_t * | count | ||
) |
Definition at line 482 of file usb_device.c.
References usb_device::cdesc, count, usb_device::ifaces_max, USB_ERR_NORMAL_COMPLETION, and USB_ERR_NOT_CONFIGURED.
usb_error_t usbd_set_alt_interface_index | ( | struct usb_device * | udev, |
uint8_t | iface_index, | ||
uint8_t | alt_index | ||
) |
Definition at line 1034 of file usb_device.c.
References usb_interface::alt_index, usb_interface_descriptor::bAlternateSetting, usb_interface::idesc, usb_config_parse(), USB_ERR_INVAL, usbd_enum_lock(), usbd_enum_unlock(), usbd_get_iface(), and usbd_req_set_alt_interface_no().
Referenced by cdce_attach(), g_audio_attach(), ipheth_attach(), uhid_snes_attach(), uhub_attach(), ulpt_attach(), umass_attach(), and urndis_attach().
usb_error_t usbd_set_config_index | ( | struct usb_device * | udev, |
uint8_t | index | ||
) |
Definition at line 672 of file usb_device.c.
References usb_device::address, usb_config_descriptor::bConfigurationValue, usb_config_descriptor::bmAttributes, usb_config_descriptor::bMaxPower, usb_device::cdesc, usb_device::curr_config_index, usb_device::curr_config_no, DPRINTF, usb_device::flags, usb_device::hub, index, usb_device::parent_hub, usb_hub::portpower, usb_device::power, usb_device_flags::self_powered, usb_device::state, UC_BUS_POWERED, UC_SELF_POWERED, UDESC_CONFIG, UDS_SELF_POWERED, UGETW, usb_device_flags::uq_bus_powered, USB_CFG_ALLOC, USB_CFG_INIT, usb_config_parse(), USB_ERR_NO_POWER, USB_IFACE_INDEX_ANY, USB_MAX_POWER, usb_device_flags::usb_mode, USB_MODE_DEVICE, USB_MODE_HOST, usb_set_device_state(), USB_STATE_ADDRESSED, USB_STATE_CONFIGURED, USB_UNCONFIG_INDEX, USB_UNCONFIG_NO, usb_unconfigure(), usbd_enum_lock(), usbd_enum_unlock(), usbd_errstr(), usbd_req_get_config_desc_full(), usbd_req_get_descriptor_ptr(), usbd_req_get_device_status(), usbd_req_set_config(), and usb_status::wStatus.
Referenced by uhub_explore_handle_re_enumerate(), usb_alloc_device(), usb_bus_resume(), usb_bus_shutdown(), usb_bus_suspend(), usb_handle_set_config(), and usb_msc_auto_quirk().
usb_error_t usbd_set_endpoint_mode | ( | struct usb_device * | udev, |
struct usb_endpoint * | ep, | ||
uint8_t | ep_mode | ||
) |
Definition at line 3065 of file usb_device.c.
References usb_device::bus, usb_endpoint::ep_mode, error, usb_bus::methods, usb_bus_methods::set_endpoint_mode, USB_EP_MODE_DEFAULT, USB_ERR_INVAL, usbd_enum_lock(), and usbd_enum_unlock().
Referenced by usb_init_endpoint().
usb_error_t usbd_set_endpoint_stall | ( | struct usb_device * | udev, |
struct usb_endpoint * | ep, | ||
uint8_t | do_stall | ||
) |
Definition at line 1094 of file usb_device.c.
References usb_endpoint_descriptor::bmAttributes, usb_device::bus, usb_bus_methods::clear_stall, usb_xfer_queue::curr, DPRINTF, usb_endpoint::edesc, usb_endpoint::endpoint_q, usb_endpoint::is_stalled, usb_bus::methods, usb_bus_methods::set_stall, usb_endpoint::toggle_next, UE_BULK, UE_INTERRUPT, UE_XFERTYPE, USB_BUS_LOCK, USB_BUS_UNLOCK, usb_command_wrapper(), USB_MAX_EP_STREAMS, and usb_bus_methods::xfer_stall.
Referenced by usb_handle_set_stall(), and usb_reset_iface_endpoints().
void usbd_set_parent_iface | ( | struct usb_device * | udev, |
uint8_t | iface_index, | ||
uint8_t | parent_index | ||
) |
Definition at line 1395 of file usb_device.c.
References usb_interface::parent_iface_index, and usbd_get_iface().
Referenced by cdce_attach(), g_audio_attach(), g_modem_attach(), u3g_attach(), ufoma_modem_setup(), ugensa_attach(), ugold_attach(), umodem_attach(), uplcom_attach(), and usie_attach().
usb_error_t usbd_set_pnpinfo | ( | struct usb_device * | udev, |
uint8_t | iface_index, | ||
const char * | pnpinfo | ||
) |
Definition at line 3021 of file usb_device.c.
References usb_interface::pnpinfo, USB_ERR_INVAL, USB_ERR_NOMEM, and usbd_get_iface().
Referenced by ucom_set_pnpinfo_usb().
void usbd_sr_lock | ( | struct usb_device * | udev | ) |
Definition at line 2946 of file usb_device.c.
References usb_device::sr_sx.
Referenced by usb_dev_resume_peer(), usb_dev_suspend_peer(), and usbd_ctrl_unlock().
void usbd_sr_unlock | ( | struct usb_device * | udev | ) |
Definition at line 2960 of file usb_device.c.
References usb_device::sr_sx.
Referenced by usb_dev_resume_peer(), usb_dev_suspend_peer(), and usbd_ctrl_lock().
|
static |
Definition at line 266 of file usb_device.c.
Referenced by usb_statestr().
|
static |
Definition at line 257 of file usb_device.c.
Referenced by usb_get_langid().
|
static |
Definition at line 258 of file usb_device.c.
Referenced by usb_get_langid().
int usb_template = -1 |
Definition at line 120 of file usb_device.c.
Referenced by sysctl_hw_usb_template(), and usb_alloc_device().
|
static |
Definition at line 104 of file usb_device.c.
Referenced by usb_alloc_device().