FreeBSD kernel usb device Code
|
Go to the source code of this file.
Data Structures | |
struct | usb_udev_msg |
struct | usb_host_endpoint |
struct | usb_host_interface |
struct | usb_device_flags |
struct | usb_power_save |
struct | usb_hw_ep_scratch_sub |
struct | usb_hw_ep_scratch |
struct | usb_temp_setup |
union | usb_device_scratch |
struct | usb_device_statistics |
struct | usb_device |
Macros | |
#define | USB_CTRL_XFER_MAX 2 |
#define | USB_CFG_ALLOC 0 |
#define | USB_CFG_FREE 1 |
#define | USB_CFG_INIT 2 |
#define | USB_UNCFG_FLAG_NONE 0x00 |
#define | USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ |
#define | USB_DEV_REF_MAX 0xffff |
#define | USB_RE_ENUM_DONE 0 |
#define | USB_RE_ENUM_START 1 |
#define | USB_RE_ENUM_PWR_OFF 2 |
#define | USB_RE_ENUM_SET_CONFIG 3 |
Variables | |
struct usb_endpoint_descriptor | desc |
struct usb_xfer * | bsd_xfer [2] |
uint8_t * | extra |
usb_frlength_t | fbsd_buf_size |
uint16_t | extralen |
uint8_t | bsd_iface_index |
struct usb_host_endpoint * | endpoint |
const char * | string |
struct usb_device_flags | __aligned |
int | usb_template |
#define USB_CFG_ALLOC 0 |
Definition at line 49 of file usb_device.h.
#define USB_CFG_FREE 1 |
Definition at line 50 of file usb_device.h.
#define USB_CFG_INIT 2 |
Definition at line 51 of file usb_device.h.
#define USB_CTRL_XFER_MAX 2 |
Definition at line 45 of file usb_device.h.
#define USB_DEV_REF_MAX 0xffff |
Definition at line 237 of file usb_device.h.
#define USB_RE_ENUM_DONE 0 |
Definition at line 257 of file usb_device.h.
#define USB_RE_ENUM_PWR_OFF 2 |
Definition at line 259 of file usb_device.h.
#define USB_RE_ENUM_SET_CONFIG 3 |
Definition at line 260 of file usb_device.h.
#define USB_RE_ENUM_START 1 |
Definition at line 258 of file usb_device.h.
#define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ |
Definition at line 56 of file usb_device.h.
#define USB_UNCFG_FLAG_NONE 0x00 |
Definition at line 55 of file usb_device.h.
struct usb_host_endpoint __aligned | ( | USB_HOST_ALIGN | ) |
__aligned::TAILQ_HEAD | ( | urb | ) |
Referenced by dwc_otg_update_host_transfer_schedule_locked().
uint8_t uhub_count_active_host_ports | ( | struct usb_device * | udev, |
enum | usb_dev_speed | ||
) |
Definition at line 386 of file usb_hub.c.
References usb_device::bus, child, usb_device::hub, usb_hub::hubsoftc, usb_hub::nports, usb_hub::ports, usb_bus_port_get_device(), and USB_MODE_HOST.
Referenced by usbd_req_re_enumerate().
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().
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().
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().
void usb_linux_free_device | ( | struct usb_device * | dev | ) |
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().
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 | ||
) |
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().
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_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().
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_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_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().
struct usb_device_flags __aligned |
uint8_t bsd_iface_index |
Definition at line 6 of file usb_device.h.
struct usb_xfer* bsd_xfer[2] |
Definition at line 2 of file usb_device.h.
struct usb_interface_descriptor desc |
Definition at line 0 of file usb_device.h.
Referenced by ehci_pci_probe(), hid_get_descriptor_from_usb(), ohci_pci_probe(), rum_set_beacon(), rum_setup_tx_desc(), uath_bulk_rx_callback(), uath_data_rxeof(), uath_dataflush(), uath_tx_start(), ufoma_get_intconf(), uhci_pci_probe(), uhso_attach(), uhso_attach_muxserial(), upgt_tx_done(), ural_setup_tx_desc(), usb_desc_foreach(), usb_ed_comp_foreach(), usb_edesc_foreach(), usb_hw_ep_get_needs(), usb_hw_ep_resolve(), usbd_do_request_flags(), usbd_find_descriptor(), usbd_get_no_alts(), usbd_get_no_descriptors(), usbd_req_get_desc(), uvisor_init(), xhci_pci_probe(), zyd_bulk_read_callback(), and zyd_tx_start().
struct usb_host_endpoint* endpoint |
Definition at line 2 of file usb_device.h.
Referenced by usbd_req_clear_tt_buffer().
uint8_t * extra |
Definition at line 3 of file usb_device.h.
uint16_t extralen |
Definition at line 5 of file usb_device.h.
usb_frlength_t fbsd_buf_size |
Definition at line 4 of file usb_device.h.
const char* string |
Definition at line 3 of file usb_device.h.
|
extern |
Definition at line 120 of file usb_device.c.
Referenced by sysctl_hw_usb_template(), and usb_alloc_device().