Changeset 129b821f in mainline for uspace/drv/bus/usb/usbhub
- Timestamp:
- 2018-01-20T12:34:50Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 682c9354
- Parents:
- 60d3f35
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 12:33:42)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 12:34:50)
- Location:
- uspace/drv/bus/usb/usbhub
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
r60d3f35 r129b821f 89 89 } 90 90 91 92 static usb_speed_t get_port_speed(usb_hub_port_t *port, uint32_t status) 93 { 94 assert(port); 95 assert(port->hub); 96 97 return usb_port_speed(port->hub->speed, status); 98 } 99 91 100 /** 92 101 * Routine for adding a new device. … … 203 212 // The connecting fibril do not touch speed until the port is enabled, 204 213 // so we do not have to lock 205 port->speed = usb_port_speed(status);214 port->speed = get_port_speed(port, status); 206 215 usb_port_enabled(&port->base); 207 216 } else -
uspace/drv/bus/usb/usbhub/status.h
r60d3f35 r129b821f 97 97 (uint32_usb2host(1 << (16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER))) 98 98 99 100 /** 101 * speed getter for port status 102 * 103 * @param status 104 * @return speed of usb device (for more see usb specification) 105 */ 106 static inline usb_speed_t usb_port_speed(usb_port_status_t status) 99 static inline usb_speed_t usb_port_speed(usb_speed_t hub_speed, uint32_t status) 107 100 { 101 if (hub_speed == USB_SPEED_SUPER) 102 return USB_SPEED_SUPER; 103 if (hub_speed == USB_SPEED_HIGH && (status & USB_HUB_PORT_STATUS_HIGH_SPEED)) 104 return USB_SPEED_HIGH; 108 105 if ((status & USB_HUB_PORT_STATUS_LOW_SPEED) != 0) 109 106 return USB_SPEED_LOW; 110 if ((status & USB_HUB_PORT_STATUS_HIGH_SPEED) != 0)111 return USB_SPEED_HIGH;112 /* TODO: add super speed */113 107 return USB_SPEED_FULL; 114 108 } -
uspace/drv/bus/usb/usbhub/usbhub.c
r60d3f35 r129b821f 116 116 } 117 117 hub_dev->usb_device = usb_dev; 118 hub_dev->speed = usb_device_get_speed(usb_dev); 118 119 119 120 fibril_mutex_initialize(&hub_dev->default_address_guard); … … 187 188 } 188 189 189 usb_log_info("Controlling hub '%s' (%p: %zu ports).", 190 usb_log_info("Controlling %s-speed hub '%s' (%p: %zu ports).", 191 usb_str_speed(hub_dev->speed), 190 192 usb_device_get_name(hub_dev->usb_device), hub_dev, 191 193 hub_dev->port_count); -
uspace/drv/bus/usb/usbhub/usbhub.h
r60d3f35 r129b821f 58 58 /** Port structures, one for each port */ 59 59 usb_hub_port_t *ports; 60 /** Speed of the hub */ 61 usb_speed_t speed; 60 62 /** Generic usb device data*/ 61 63 usb_device_t *usb_device;
Note:
See TracChangeset
for help on using the changeset viewer.
