Changeset ae3a941 in mainline for uspace/drv/bus/usb
- Timestamp:
- 2018-02-26T16:51:40Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e773f58
- Parents:
- 3692678
- Location:
- uspace/drv/bus/usb
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_batch.h
r3692678 rae3a941 63 63 } ehci_transfer_batch_t; 64 64 65 ehci_transfer_batch_t * 65 ehci_transfer_batch_t *ehci_transfer_batch_create(endpoint_t *ep); 66 66 int ehci_transfer_batch_prepare(ehci_transfer_batch_t *batch); 67 67 void ehci_transfer_batch_commit(const ehci_transfer_batch_t *batch); … … 69 69 void ehci_transfer_batch_destroy(ehci_transfer_batch_t *batch); 70 70 71 static inline ehci_transfer_batch_t * ehci_transfer_batch_get(usb_transfer_batch_t *usb_batch) 71 static inline ehci_transfer_batch_t *ehci_transfer_batch_get( 72 usb_transfer_batch_t *usb_batch) 72 73 { 73 74 assert(usb_batch); -
uspace/drv/bus/usb/ehci/ehci_bus.c
r3692678 rae3a941 54 54 ehci_endpoint_t *instance = ehci_endpoint_get(ep); 55 55 if (qh_toggle_from_td(instance->qh)) 56 usb_log_warning("EP(%p): Resetting toggle bit for transfer directed EP", instance); 56 usb_log_warning("EP(%p): Resetting toggle bit for transfer " 57 "directed EP", instance); 57 58 qh_toggle_set(instance->qh, 0); 58 59 } … … 72 73 /** Creates new hcd endpoint representation. 73 74 */ 74 static endpoint_t *ehci_endpoint_create(device_t *dev, const usb_endpoint_descriptors_t *desc) 75 static endpoint_t *ehci_endpoint_create(device_t *dev, 76 const usb_endpoint_descriptors_t *desc) 75 77 { 76 78 assert(dev); -
uspace/drv/bus/usb/ehci/ehci_bus.h
r3692678 rae3a941 78 78 * @return Pointer to assigned ehci endpoint structure 79 79 */ 80 static inline ehci_endpoint_t * 80 static inline ehci_endpoint_t *ehci_endpoint_get(const endpoint_t *ep) 81 81 { 82 82 assert(ep); … … 84 84 } 85 85 86 static inline ehci_endpoint_t * 86 static inline ehci_endpoint_t *ehci_endpoint_list_instance(link_t *l) 87 87 { 88 88 return list_get_instance(l, ehci_endpoint_t, eplist_link); -
uspace/drv/bus/usb/ehci/ehci_rh.h
r3692678 rae3a941 80 80 } ehci_rh_t; 81 81 82 errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,83 fibril_mutex_t *guard, const char *name);82 errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, 83 ehci_regs_t *regs, fibril_mutex_t *guard, const char *name); 84 84 errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch); 85 85 errno_t ehci_rh_interrupt(ehci_rh_t *instance); -
uspace/drv/bus/usb/ehci/hc.h
r3692678 rae3a941 104 104 extern errno_t hc_start(hc_device_t *); 105 105 extern errno_t hc_setup_roothub(hc_device_t *); 106 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *); 106 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, 107 const hw_res_list_parsed_t *, int *); 107 108 extern errno_t hc_gone(hc_device_t *); 108 109 -
uspace/drv/bus/usb/ehci/hw_struct/iso_transfer_descriptor.h
r3692678 rae3a941 72 72 /* 64 bit struct only */ 73 73 volatile uint32_t extended_bp[7]; 74 } __attribute__((packed, aligned(32))) itd_t;74 } __attribute__((packed, aligned(32))) itd_t; 75 75 #endif 76 76 /** -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.c
r3692678 rae3a941 70 70 QH_EP_CHAR_EP_SET(ep->endpoint) | 71 71 speed[ep->device->speed] | 72 QH_EP_CHAR_MAX_LENGTH_SET(ep->max_packet_size) 73 ); 72 QH_EP_CHAR_MAX_LENGTH_SET(ep->max_packet_size)); 74 73 if (ep->transfer_type == USB_TRANSFER_CONTROL) { 75 74 if (ep->device->speed != USB_SPEED_HIGH) … … 80 79 } 81 80 uint32_t ep_cap = QH_EP_CAP_C_MASK_SET(3 << 2) | 82 81 QH_EP_CAP_MULTI_SET(ep->packets_per_uframe); 83 82 if (usb_speed_is_11(ep->device->speed)) { 84 83 assert(ep->device->tt.dev != NULL); -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.h
r3692678 rae3a941 143 143 /* 64 bit struct only */ 144 144 volatile uint32_t extended_bp[5]; 145 } __attribute__((packed, aligned(32))) qh_t;145 } __attribute__((packed, aligned(32))) qh_t; 146 146 147 147 static inline void qh_append_qh(qh_t *qh, const qh_t *next) -
uspace/drv/bus/usb/ehci/hw_struct/split_iso_transfer_descriptor.h
r3692678 rae3a941 89 89 /* 64 bit struct only */ 90 90 volatile uint32_t extended_bp[2]; 91 } __attribute__((packed, aligned(32))) sitd_t;91 } __attribute__((packed, aligned(32))) sitd_t; 92 92 #endif 93 93 /** -
uspace/drv/bus/usb/ohci/hc.h
r3692678 rae3a941 84 84 } hc_t; 85 85 86 static inline hc_t * 86 static inline hc_t *hcd_to_hc(hc_device_t *hcd) 87 87 { 88 88 assert(hcd); … … 91 91 92 92 extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *); 93 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *); 93 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, 94 const hw_res_list_parsed_t *, int *); 94 95 extern errno_t hc_gain_control(hc_device_t *); 95 96 extern errno_t hc_start(hc_device_t *); -
uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c
r3692678 rae3a941 84 84 | ((ep->endpoint & ED_STATUS_EN_MASK) << ED_STATUS_EN_SHIFT) 85 85 | ((dir[ep->direction] & ED_STATUS_D_MASK) << ED_STATUS_D_SHIFT) 86 | ((ep->max_packet_size & ED_STATUS_MPS_MASK) 87 << ED_STATUS_MPS_SHIFT)); 86 | ((ep->max_packet_size & ED_STATUS_MPS_MASK) << ED_STATUS_MPS_SHIFT)); 88 87 89 88 /* Low speed flag */ -
uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h
r3692678 rae3a941 107 107 #define ED_NEXT_PTR_MASK (0xfffffff0) 108 108 #define ED_NEXT_PTR_SHIFT (0) 109 } __attribute__((packed, aligned(32))) ed_t;109 } __attribute__((packed, aligned(32))) ed_t; 110 110 111 111 void ed_init(ed_t *instance, const endpoint_t *ep, const td_t *td); … … 204 204 { 205 205 assert(instance); 206 return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;206 return !!(OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY); 207 207 } 208 208 -
uspace/drv/bus/usb/ohci/hw_struct/iso_transfer_descriptor.h
r3692678 rae3a941 69 69 #define ITD_OFFSET_CC_SHIFT (12) 70 70 71 } __attribute__((packed, aligned(32))) itd_t;71 } __attribute__((packed, aligned(32))) itd_t; 72 72 73 73 #endif -
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h
r3692678 rae3a941 90 90 */ 91 91 volatile uint32_t be; 92 } __attribute__((packed, aligned(32))) td_t;92 } __attribute__((packed, aligned(32))) td_t; 93 93 94 94 void td_init(td_t *, const td_t *, usb_direction_t, const void *, size_t, int); … … 103 103 { 104 104 assert(instance); 105 const int cc = (OHCI_MEM32_RD(instance->status)106 >> TD_STATUS_CC_SHIFT)& TD_STATUS_CC_MASK;105 const int cc = (OHCI_MEM32_RD(instance->status) >> TD_STATUS_CC_SHIFT) 106 & TD_STATUS_CC_MASK; 107 107 /* This value is changed on transfer completion, 108 108 * either to CC_NOERROR or and error code. -
uspace/drv/bus/usb/ohci/ohci_batch.h
r3692678 rae3a941 65 65 } ohci_transfer_batch_t; 66 66 67 ohci_transfer_batch_t * 67 ohci_transfer_batch_t *ohci_transfer_batch_create(endpoint_t *batch); 68 68 int ohci_transfer_batch_prepare(ohci_transfer_batch_t *ohci_batch); 69 69 void ohci_transfer_batch_commit(const ohci_transfer_batch_t *batch); … … 71 71 void ohci_transfer_batch_destroy(ohci_transfer_batch_t *ohci_batch); 72 72 73 static inline ohci_transfer_batch_t * ohci_transfer_batch_get(usb_transfer_batch_t *usb_batch) 73 static inline ohci_transfer_batch_t *ohci_transfer_batch_get( 74 usb_transfer_batch_t *usb_batch) 74 75 { 75 76 assert(usb_batch); -
uspace/drv/bus/usb/ohci/ohci_bus.c
r3692678 rae3a941 72 72 /** Creates new hcd endpoint representation. 73 73 */ 74 static endpoint_t *ohci_endpoint_create(device_t *dev, const usb_endpoint_descriptors_t *desc) 74 static endpoint_t *ohci_endpoint_create(device_t *dev, 75 const usb_endpoint_descriptors_t *desc) 75 76 { 76 77 assert(dev); … … 82 83 endpoint_init(&ohci_ep->base, dev, desc); 83 84 84 const errno_t err = dma_buffer_alloc(&ohci_ep->dma_buffer, sizeof(ed_t) + 2 * sizeof(td_t)); 85 const errno_t err = dma_buffer_alloc(&ohci_ep->dma_buffer, 86 sizeof(ed_t) + 2 * sizeof(td_t)); 85 87 if (err) { 86 88 free(ohci_ep); -
uspace/drv/bus/usb/uhci/hw_struct/queue_head.h
r3692678 rae3a941 48 48 /** Pointer to the next entity (another QH or TD */ 49 49 volatile link_pointer_t next; 50 /** Pointer to the contained entities (execution controlled by vertical flag*/ 50 /** 51 * Pointer to the contained entities 52 * (execution controlled by vertical flag) 53 */ 51 54 volatile link_pointer_t element; 52 } __attribute__((packed, aligned(16))) qh_t;55 } __attribute__((packed, aligned(16))) qh_t; 53 56 54 57 /** Initialize queue head structure -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h
r3692678 rae3a941 95 95 * memory just needs to be aligned. We don't use it anyway. 96 96 */ 97 } __attribute__((packed, aligned(16))) td_t;97 } __attribute__((packed, aligned(16))) td_t; 98 98 99 99 -
uspace/drv/bus/usb/uhci/uhci_batch.h
r3692678 rae3a941 70 70 } uhci_transfer_batch_t; 71 71 72 uhci_transfer_batch_t * 72 uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *); 73 73 int uhci_transfer_batch_prepare(uhci_transfer_batch_t *); 74 74 bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *); … … 79 79 * @return Pointer to the setup buffer. 80 80 */ 81 static inline void * 81 static inline void *uhci_transfer_batch_setup_buffer( 82 82 const uhci_transfer_batch_t *uhci_batch) 83 83 { … … 91 91 * @return Pointer to the data buffer. 92 92 */ 93 static inline void * 93 static inline void *uhci_transfer_batch_data_buffer( 94 94 const uhci_transfer_batch_t *uhci_batch) 95 95 { … … 108 108 } 109 109 110 static inline uhci_transfer_batch_t *uhci_transfer_batch_get(usb_transfer_batch_t *b) 110 static inline uhci_transfer_batch_t *uhci_transfer_batch_get( 111 usb_transfer_batch_t *b) 111 112 { 112 113 assert(b); -
uspace/drv/bus/usb/usbdiag/device.h
r3692678 rae3a941 77 77 } usbdiag_dev_t; 78 78 79 errno_t usbdiag_dev_create(usb_device_t *, usbdiag_dev_t **, const usb_endpoint_description_t **); 79 errno_t usbdiag_dev_create(usb_device_t *, usbdiag_dev_t **, 80 const usb_endpoint_description_t **); 80 81 void usbdiag_dev_destroy(usbdiag_dev_t *); 81 82 82 static inline usbdiag_dev_t * 83 static inline usbdiag_dev_t *usb_device_to_usbdiag_dev(usb_device_t *usb_dev) 83 84 { 84 85 assert(usb_dev); … … 86 87 } 87 88 88 static inline usbdiag_dev_t * 89 static inline usbdiag_dev_t *ddf_dev_to_usbdiag_dev(ddf_dev_t *ddf_dev) 89 90 { 90 91 assert(ddf_dev); … … 92 93 } 93 94 94 static inline usbdiag_dev_t * 95 static inline usbdiag_dev_t *ddf_fun_to_usbdiag_dev(ddf_fun_t *ddf_fun) 95 96 { 96 97 assert(ddf_fun); -
uspace/drv/bus/usb/usbdiag/tests.h
r3692678 rae3a941 39 39 #include <ddf/driver.h> 40 40 41 errno_t usbdiag_dev_test_in(ddf_fun_t *, const usbdiag_test_params_t *, usbdiag_test_results_t *); 42 errno_t usbdiag_dev_test_out(ddf_fun_t *, const usbdiag_test_params_t *, usbdiag_test_results_t *); 41 errno_t usbdiag_dev_test_in(ddf_fun_t *, const usbdiag_test_params_t *, 42 usbdiag_test_results_t *); 43 errno_t usbdiag_dev_test_out(ddf_fun_t *, const usbdiag_test_params_t *, 44 usbdiag_test_results_t *); 43 45 44 46 #endif /* USBDIAG_TESTS_H_ */ -
uspace/drv/bus/usb/usbhub/port.c
r3692678 rae3a941 49 49 #include "status.h" 50 50 51 #define port_log(lvl, port, fmt, ...) do { usb_log_##lvl("(%p-%u): " fmt, (port->hub), (port->port_number), ##__VA_ARGS__); } while (0) 51 #define port_log(lvl, port, fmt, ...) do { \ 52 usb_log_##lvl("(%p-%u): " fmt, \ 53 (port->hub), (port->port_number), ##__VA_ARGS__); \ 54 } while (0) 52 55 53 56 /** Initialize hub port information. … … 55 58 * @param port Port to be initialized. 56 59 */ 57 void usb_hub_port_init(usb_hub_port_t *port, usb_hub_dev_t *hub, unsigned int port_number) 60 void usb_hub_port_init(usb_hub_port_t *port, usb_hub_dev_t *hub, 61 unsigned int port_number) 58 62 { 59 63 assert(port); … … 79 83 async_exch_t *exch = usb_device_bus_exchange_begin(port->hub->usb_device); 80 84 if (!exch) { 81 port_log(error, port, "Cannot remove the device, failed creating exchange."); 85 port_log(error, port, "Cannot remove the device, " 86 "failed creating exchange."); 82 87 return; 83 88 } … … 85 90 const errno_t err = usbhc_device_remove(exch, port->port_number); 86 91 if (err) 87 port_log(error, port, "Failed to remove device: %s", str_error(err)); 92 port_log(error, port, "Failed to remove device: %s", 93 str_error(err)); 88 94 89 95 usb_device_bus_exchange_end(exch); … … 109 115 err = usb_hub_reserve_default_address(port->hub, exch, &port->base); 110 116 if (err != EOK) { 111 port_log(error, port, "Failed to reserve default address: %s", str_error(err)); 117 port_log(error, port, "Failed to reserve default address: %s", 118 str_error(err)); 112 119 return err; 113 120 } … … 118 125 119 126 port_log(debug, port, "Resetting port."); 120 if ((err = usb_hub_set_port_feature(port->hub, port->port_number, USB_HUB_FEATURE_PORT_RESET))) { 121 port_log(warning, port, "Port reset request failed: %s", str_error(err)); 127 if ((err = usb_hub_set_port_feature(port->hub, port->port_number, 128 USB_HUB_FEATURE_PORT_RESET))) { 129 port_log(warning, port, "Port reset request failed: %s", 130 str_error(err)); 122 131 goto out_address; 123 132 } 124 133 125 134 if ((err = usb_port_wait_for_enabled(&port->base))) { 126 port_log(error, port, "Failed to reset port: %s", str_error(err)); 135 port_log(error, port, "Failed to reset port: %s", 136 str_error(err)); 127 137 goto out_address; 128 138 } 129 139 130 140 port_log(debug, port, "Enumerating device."); 131 if ((err = usbhc_device_enumerate(exch, port->port_number, port->speed))) { 132 port_log(error, port, "Failed to enumerate device: %s", str_error(err)); 141 if ((err = usbhc_device_enumerate(exch, port->port_number, 142 port->speed))) { 143 port_log(error, port, "Failed to enumerate device: %s", 144 str_error(err)); 133 145 /* Disable the port */ 134 usb_hub_clear_port_feature(port->hub, port->port_number, USB2_HUB_FEATURE_PORT_ENABLE); 146 usb_hub_clear_port_feature(port->hub, port->port_number, 147 USB2_HUB_FEATURE_PORT_ENABLE); 135 148 goto out_address; 136 149 } … … 151 164 152 165 port_log(debug, port, "Issuing a warm reset."); 153 if ((err = usb_hub_set_port_feature(port->hub, port->port_number, USB3_HUB_FEATURE_BH_PORT_RESET))) { 154 port_log(warning, port, "Port reset request failed: %s", str_error(err)); 166 if ((err = usb_hub_set_port_feature(port->hub, port->port_number, 167 USB3_HUB_FEATURE_BH_PORT_RESET))) { 168 port_log(warning, port, "Port reset request failed: %s", 169 str_error(err)); 155 170 return err; 156 171 } 157 172 158 173 if ((err = usb_port_wait_for_enabled(&port->base))) { 159 port_log(error, port, "Failed to reset port: %s", str_error(err)); 174 port_log(error, port, "Failed to reset port: %s", 175 str_error(err)); 160 176 return err; 161 177 } 162 178 163 179 port_log(debug, port, "Enumerating device."); 164 if ((err = usbhc_device_enumerate(exch, port->port_number, port->speed))) { 165 port_log(error, port, "Failed to enumerate device: %s", str_error(err)); 180 if ((err = usbhc_device_enumerate(exch, port->port_number, 181 port->speed))) { 182 port_log(error, port, "Failed to enumerate device: %s", 183 str_error(err)); 166 184 return err; 167 185 } … … 193 211 { 194 212 const bool connected = !!(status & USB_HUB_PORT_STATUS_CONNECTION); 195 port_log(debug, port, "Connection change: device %s.", connected ? "attached" : "removed"); 213 port_log(debug, port, "Connection change: device %s.", connected 214 ? "attached" : "removed"); 196 215 197 216 if (connected) { … … 212 231 } 213 232 214 static void port_changed_overcurrent(usb_hub_port_t *port, usb_port_status_t status) 233 static void port_changed_overcurrent(usb_hub_port_t *port, 234 usb_port_status_t status) 215 235 { 216 236 const bool overcurrent = !!(status & USB_HUB_PORT_STATUS_OC); … … 225 245 226 246 if (!overcurrent) { 227 const errno_t err = usb_hub_set_port_feature(port->hub, port->port_number, USB_HUB_FEATURE_PORT_POWER); 247 const errno_t err = usb_hub_set_port_feature(port->hub, 248 port->port_number, USB_HUB_FEATURE_PORT_POWER); 228 249 if (err) 229 port_log(error, port, "Failed to set port power after OC: %s.", str_error(err)); 250 port_log(error, port, "Failed to set port power " 251 "after OC: %s.", str_error(err)); 230 252 } 231 253 } … … 245 267 246 268 static void check_port_change(usb_hub_port_t *port, usb_port_status_t *status, 247 change_handler_t handler, usb_port_status_t mask, usb_hub_class_feature_t feature) 269 change_handler_t handler, usb_port_status_t mask, 270 usb_hub_class_feature_t feature) 248 271 { 249 272 if ((*status & mask) == 0) … … 273 296 274 297 usb_port_status_t status = 0; 275 const errno_t err = usb_hub_get_port_status(port->hub, port->port_number, &status); 298 const errno_t err = usb_hub_get_port_status(port->hub, 299 port->port_number, &status); 276 300 if (err != EOK) { 277 port_log(error, port, "Failed to get port status: %s.", str_error(err)); 301 port_log(error, port, "Failed to get port status: %s.", 302 str_error(err)); 278 303 return; 279 304 } 280 305 281 306 check_port_change(port, &status, &port_changed_connection, 282 USB_HUB_PORT_STATUS_C_CONNECTION, USB_HUB_FEATURE_C_PORT_CONNECTION); 307 USB_HUB_PORT_STATUS_C_CONNECTION, 308 USB_HUB_FEATURE_C_PORT_CONNECTION); 283 309 284 310 check_port_change(port, &status, &port_changed_overcurrent, … … 290 316 if (port->hub->speed <= USB_SPEED_HIGH) { 291 317 check_port_change(port, &status, &port_changed_enabled, 292 USB2_HUB_PORT_STATUS_C_ENABLE, USB2_HUB_FEATURE_C_PORT_ENABLE); 318 USB2_HUB_PORT_STATUS_C_ENABLE, 319 USB2_HUB_FEATURE_C_PORT_ENABLE); 293 320 } else { 294 321 check_port_change(port, &status, &port_changed_reset, 295 USB3_HUB_PORT_STATUS_C_BH_RESET, USB3_HUB_FEATURE_C_BH_PORT_RESET); 322 USB3_HUB_PORT_STATUS_C_BH_RESET, 323 USB3_HUB_FEATURE_C_BH_PORT_RESET); 296 324 297 325 check_port_change(port, &status, NULL, 298 USB3_HUB_PORT_STATUS_C_LINK_STATE, USB3_HUB_FEATURE_C_PORT_LINK_STATE); 326 USB3_HUB_PORT_STATUS_C_LINK_STATE, 327 USB3_HUB_FEATURE_C_PORT_LINK_STATE); 299 328 } 300 329 301 330 /* Check for changes we ignored */ 302 331 if (status & 0xffff0000) { 303 port_log(debug, port, "Port status change igored. Status: %#08" PRIx32, status); 332 port_log(debug, port, "Port status change igored. " 333 "Status: %#08" PRIx32, status); 304 334 } 305 335 } -
uspace/drv/bus/usb/usbhub/status.h
r3692678 rae3a941 59 59 if (hub_speed == USB_SPEED_SUPER) 60 60 return USB_SPEED_SUPER; 61 if (hub_speed == USB_SPEED_HIGH && (status & USB2_HUB_PORT_STATUS_HIGH_SPEED)) 61 if (hub_speed == USB_SPEED_HIGH 62 && (status & USB2_HUB_PORT_STATUS_HIGH_SPEED)) 62 63 return USB_SPEED_HIGH; 63 64 if ((status & USB2_HUB_PORT_STATUS_LOW_SPEED) != 0) -
uspace/drv/bus/usb/usbhub/usbhub.h
r3692678 rae3a941 84 84 85 85 errno_t usb_hub_set_depth(const usb_hub_dev_t *); 86 errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t, usb_port_status_t *); 87 errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t); 88 errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t); 86 errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t, 87 usb_port_status_t *); 88 errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, 89 usb_hub_class_feature_t); 90 errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, 91 usb_hub_class_feature_t); 89 92 90 93 bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *); 91 94 92 errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, usb_port_t *); 95 errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, 96 usb_port_t *); 93 97 errno_t usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *); 94 98 -
uspace/drv/bus/usb/usbmid/dump.c
r3692678 rae3a941 54 54 const int type = data[1]; 55 55 if (type == USB_DESCTYPE_INTERFACE) { 56 usb_standard_interface_descriptor_t *descriptor 57 =(usb_standard_interface_descriptor_t *) data;56 usb_standard_interface_descriptor_t *descriptor = 57 (usb_standard_interface_descriptor_t *) data; 58 58 usb_log_info("Found interface: %s (0x%02x/0x%02x/0x%02x).", 59 59 usb_str_class(descriptor->interface_class), -
uspace/drv/bus/usb/vhc/hub/hub.c
r3692678 rae3a941 68 68 69 69 /** Convert hub port state to a char. */ 70 char hub_port_state_to_char(hub_port_state_t state) { 70 char hub_port_state_to_char(hub_port_state_t state) 71 { 71 72 switch (state) { 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 73 case HUB_PORT_STATE_NOT_CONFIGURED: 74 return '-'; 75 case HUB_PORT_STATE_POWERED_OFF: 76 return 'O'; 77 case HUB_PORT_STATE_DISCONNECTED: 78 return 'X'; 79 case HUB_PORT_STATE_DISABLED: 80 return 'D'; 81 case HUB_PORT_STATE_RESETTING: 82 return 'R'; 83 case HUB_PORT_STATE_ENABLED: 84 return 'E'; 85 case HUB_PORT_STATE_SUSPENDED: 86 return 'S'; 87 case HUB_PORT_STATE_RESUMING: 88 return 'F'; 89 default: 90 return '?'; 90 91 } 91 92 } … … 234 235 235 236 switch (state) { 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 237 case HUB_PORT_STATE_POWERED_OFF: 238 clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION); 239 clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE); 240 clear_port_status_change(port, HUB_STATUS_C_PORT_RESET); 241 break; 242 case HUB_PORT_STATE_RESUMING: 243 port->state = state; 244 set_port_state_delayed(hub, port_index, 245 10, state, HUB_PORT_STATE_ENABLED); 246 break; 247 case HUB_PORT_STATE_RESETTING: 248 port->state = state; 249 set_port_state_delayed(hub, port_index, 250 10, state, HUB_PORT_STATE_ENABLED); 251 break; 252 case HUB_PORT_STATE_ENABLED: 253 if (port->state == HUB_PORT_STATE_RESETTING) { 254 set_port_status_change(port, HUB_STATUS_C_PORT_RESET); 255 } 256 break; 257 default: 258 break; 258 259 } 259 260 … … 336 337 } 337 338 338 uint32_t status; 339 status = MAKE_BYTE( 339 uint32_t status = MAKE_BYTE( 340 340 /* Current connect status. */ 341 341 port->connected_device == NULL ? 0 : 1, … … 344 344 /* Suspend. */ 345 345 (port->state == HUB_PORT_STATE_SUSPENDED) 346 346 || (port->state == HUB_PORT_STATE_RESUMING) ? 1 : 0, 347 347 /* Over-current. */ 348 348 0, … … 350 350 port->state == HUB_PORT_STATE_RESETTING ? 1 : 0, 351 351 /* Reserved. */ 352 0, 0, 0) 353 354 | (MAKE_BYTE(352 0, 0, 0); 353 354 status |= MAKE_BYTE( 355 355 /* Port power. */ 356 356 port->state == HUB_PORT_STATE_POWERED_OFF ? 0 : 1, … … 359 359 /* Reserved. */ 360 360 0, 0, 0, 0, 0, 0 361 ) )<< 8;361 ) << 8; 362 362 363 363 status |= (port->status_change << 16); … … 463 463 static errno_t set_port_state_delayed_fibril(void *arg) 464 464 { 465 struct delay_port_state_change *change 466 =(struct delay_port_state_change *) arg;465 struct delay_port_state_change *change = 466 (struct delay_port_state_change *) arg; 467 467 468 468 async_usleep(change->delay); … … 500 500 hub_port_state_t old_state, hub_port_state_t new_state) 501 501 { 502 struct delay_port_state_change *change 503 =malloc(sizeof(struct delay_port_state_change));502 struct delay_port_state_change *change = 503 malloc(sizeof(struct delay_port_state_change)); 504 504 505 505 change->hub = hub; -
uspace/drv/bus/usb/vhc/transfer.c
r3692678 rae3a941 50 50 return false; 51 51 } 52 const usb_device_request_setup_packet_t *setup 53 =&transfer->batch.setup.packet;52 const usb_device_request_setup_packet_t *setup = 53 &transfer->batch.setup.packet; 54 54 if (setup->request_type != 0) { 55 55 return false; … … 139 139 assert(!list_empty(&dev->transfer_queue)); 140 140 141 vhc_transfer_t *transfer = list_get_instance( 142 list_first(&dev->transfer_queue), vhc_transfer_t, link); 141 vhc_transfer_t *transfer = 142 list_get_instance(list_first(&dev->transfer_queue), 143 vhc_transfer_t, link); 143 144 list_remove(&transfer->link); 144 145 … … 258 259 dev->dev_local, &data_transfer_size); 259 260 } else { 260 usb_log_warning("Device has no remote phone nor local node."); 261 usb_log_warning("Device has no remote phone " 262 "nor local node."); 261 263 rc = ESTALL; 262 264 } … … 269 271 if (is_set_address_transfer(transfer)) { 270 272 usb_device_request_setup_packet_t *setup = 271 (void *) transfer->batch.setup.buffer;273 (void *) transfer->batch.setup.buffer; 272 274 dev->address = setup->value; 273 275 usb_log_debug2("Address changed to %d", -
uspace/drv/bus/usb/vhc/vhcd.h
r3692678 rae3a941 93 93 errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *); 94 94 errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *); 95 errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address); 95 errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, 96 usb_address_t address); 96 97 void vhc_virtdev_unplug(vhc_data_t *, uintptr_t); 97 98 -
uspace/drv/bus/usb/xhci/bus.h
r3692678 rae3a941 45 45 /** Endpoint management structure */ 46 46 typedef struct xhci_bus { 47 bus_t base; /**< Inheritance. Keep this first. */ 48 49 xhci_hc_t *hc; /**< Pointer to managing HC (to issue commands) */ 50 51 xhci_device_t **devices_by_slot; /**< Devices by Slot ID */ 47 bus_t base; /**< Inheritance. Keep this first. */ 48 xhci_hc_t *hc; /**< Pointer to managing HC (to issue commands) */ 49 xhci_device_t **devices_by_slot; /**< Devices by Slot ID */ 52 50 } xhci_bus_t; 53 51 -
uspace/drv/bus/usb/xhci/commands.c
r3692678 rae3a941 150 150 151 151 while (cmd_link != NULL) { 152 xhci_cmd_t *cmd = list_get_instance(cmd_link, xhci_cmd_t, _header.link); 152 xhci_cmd_t *cmd = list_get_instance(cmd_link, xhci_cmd_t, 153 _header.link); 153 154 154 155 if (cmd->_header.trb_phys == phys) … … 158 159 } 159 160 160 return cmd_link ? list_get_instance(cmd_link, xhci_cmd_t, _header.link) 161 : NULL; 161 return cmd_link 162 ? list_get_instance(cmd_link, xhci_cmd_t, _header.link) 163 : NULL; 162 164 } 163 165 … … 167 169 168 170 cr->state = state; 169 if (state == XHCI_CR_STATE_OPEN 170 || state == XHCI_CR_STATE_CLOSED) 171 if (state == XHCI_CR_STATE_OPEN || state == XHCI_CR_STATE_CLOSED) 171 172 fibril_condvar_broadcast(&cr->state_cv); 172 173 } … … 206 207 } 207 208 208 usb_log_debug("Sending command %s", xhci_trb_str_type(TRB_TYPE(cmd->_header.trb))); 209 usb_log_debug("Sending command %s", 210 xhci_trb_str_type(TRB_TYPE(cmd->_header.trb))); 209 211 210 212 list_append(&cmd->_header.link, &cr->cmd_list); … … 337 339 usb_log_error("Command resulted in error: %s.", trb_codes[code]); 338 340 else 339 usb_log_error("Command resulted in reserved or vendor specific error."); 341 usb_log_error("Command resulted in reserved or " 342 "vendor specific error."); 340 343 } 341 344 … … 657 660 } 658 661 659 usb_log_error("Timeout while waiting for command: aborting current command."); 662 usb_log_error("Timeout while waiting for command: " 663 "aborting current command."); 660 664 661 665 cr_set_state(cr, XHCI_CR_STATE_CHANGING); … … 663 667 abort_command_ring(hc); 664 668 665 fibril_condvar_wait_timeout(&cr->stopped_cv, &cr->guard, XHCI_CR_ABORT_TIMEOUT); 669 fibril_condvar_wait_timeout(&cr->stopped_cv, &cr->guard, 670 XHCI_CR_ABORT_TIMEOUT); 666 671 667 672 if (XHCI_REG_RD(hc->op_regs, XHCI_OP_CRR)) { -
uspace/drv/bus/usb/xhci/commands.h
r3692678 rae3a941 70 70 71 71 typedef enum { 72 XHCI_CR_STATE_CLOSED, 73 XHCI_CR_STATE_OPEN, 74 XHCI_CR_STATE_CHANGING, 75 XHCI_CR_STATE_FULL, 72 XHCI_CR_STATE_CLOSED, /**< Commands are rejected with ENAK. */ 73 XHCI_CR_STATE_OPEN, /**< Commands are enqueued normally. */ 74 XHCI_CR_STATE_CHANGING, /**< Commands wait until state changes. */ 75 XHCI_CR_STATE_FULL, /**< Commands wait until something completes. */ 76 76 } xhci_cr_state_t; 77 77 -
uspace/drv/bus/usb/xhci/debug.h
r3692678 rae3a941 63 63 extern void xhci_dump_slot_ctx(const struct xhci_slot_ctx *); 64 64 extern void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *); 65 extern void xhci_dump_input_ctx(const struct xhci_hc *, const struct xhci_input_ctx *); 65 extern void xhci_dump_input_ctx(const struct xhci_hc *, 66 const struct xhci_input_ctx *); 66 67 67 68 #endif -
uspace/drv/bus/usb/xhci/device.h
r3692678 rae3a941 62 62 63 63 #define XHCI_DEV_FMT "(%s, slot %d)" 64 #define XHCI_DEV_ARGS(dev) 64 #define XHCI_DEV_ARGS(dev) ddf_fun_get_name((dev).base.fun), (dev).slot_id 65 65 66 66 /* Bus callbacks */ … … 72 72 void xhci_setup_slot_context(xhci_device_t *, xhci_slot_ctx_t *); 73 73 74 static inline xhci_device_t * 74 static inline xhci_device_t *xhci_device_get(device_t *dev) 75 75 { 76 76 assert(dev); -
uspace/drv/bus/usb/xhci/endpoint.h
r3692678 rae3a941 76 76 xhci_trb_ring_t ring; 77 77 78 /** Primary stream context data array (or NULL if endpoint doesn't use streams). */ 78 /** 79 * Primary stream context data array 80 * (or NULL if endpoint doesn't use streams). 81 */ 79 82 xhci_stream_data_t *primary_stream_data_array; 80 83 … … 83 86 dma_buffer_t primary_stream_ctx_dma; 84 87 85 /** Size of the allocated primary stream data a rray (and context array). */88 /** Size of the allocated primary stream data and context array. */ 86 89 uint16_t primary_stream_data_size; 87 90 … … 89 92 uint32_t max_streams; 90 93 91 /** Maximum number of consecutive USB transactions (0-15) that should be executed per scheduling opportunity */ 94 /** 95 * Maximum number of consecutive USB transactions (0-15) that 96 * should be executed per scheduling opportunity 97 */ 92 98 uint8_t max_burst; 93 99 94 /** Maximum number of bursts within an interval that this endpoint supports */ 100 /** 101 * Maximum number of bursts within an interval that 102 * this endpoint supports 103 */ 95 104 uint8_t mult; 96 105 97 /** Scheduling interval for periodic endpoints, as a number of 125us units. (0 - 2^16) */ 106 /** 107 * Scheduling interval for periodic endpoints, 108 * as a number of 125us units. (0 - 2^16) 109 */ 98 110 uint32_t interval; 99 111 100 /** This field is a valid pointer for (and only for) isochronous transfers. */ 112 /** 113 * This field is a valid pointer for (and only for) isochronous 114 * endpoints. 115 */ 101 116 xhci_isoch_t isoch [0]; 102 117 } xhci_endpoint_t; … … 111 126 extern int xhci_endpoint_type(xhci_endpoint_t *ep); 112 127 113 extern endpoint_t *xhci_endpoint_create(device_t *, const usb_endpoint_descriptors_t *); 128 extern endpoint_t *xhci_endpoint_create(device_t *, 129 const usb_endpoint_descriptors_t *); 114 130 extern errno_t xhci_endpoint_register(endpoint_t *); 115 131 extern void xhci_endpoint_unregister(endpoint_t *); … … 122 138 extern errno_t xhci_endpoint_clear_halt(xhci_endpoint_t *, unsigned); 123 139 124 static inline xhci_endpoint_t * 140 static inline xhci_endpoint_t *xhci_endpoint_get(endpoint_t *ep) 125 141 { 126 142 assert(ep); … … 128 144 } 129 145 130 static inline xhci_device_t * 146 static inline xhci_device_t *xhci_ep_to_dev(xhci_endpoint_t *ep) 131 147 { 132 148 assert(ep); -
uspace/drv/bus/usb/xhci/hc.h
r3692678 rae3a941 95 95 bool ac64; 96 96 bool csz; 97 uint64_t wrap_time; /**The last time when mfindex wrap happened */98 uint64_t wrap_count; /** Amount of mfindex wraps HC has done */99 unsigned ist; 97 uint64_t wrap_time; /**< The last time when mfindex wrap happened */ 98 uint64_t wrap_count; /**< Amount of mfindex wraps HC has done */ 99 unsigned ist; /**< IST in microframes */ 100 100 101 101 /** Port speed mapping */ -
uspace/drv/bus/usb/xhci/hw_struct/context.h
r3692678 rae3a941 179 179 #define XHCI_CTX_SIZE_SMALL 32 180 180 #define XHCI_ONE_CTX_SIZE(hc) (XHCI_CTX_SIZE_SMALL << hc->csz) 181 #define XHCI_GET_CTX_FIELD(type, ctx, hc, ci) (xhci_##type##_ctx_to_charptr(ctx) + (ci) * XHCI_ONE_CTX_SIZE(hc)) 181 #define XHCI_GET_CTX_FIELD(type, ctx, hc, ci) \ 182 (xhci_##type##_ctx_to_charptr(ctx) + (ci) * XHCI_ONE_CTX_SIZE(hc)) 182 183 183 184 /** … … 185 186 */ 186 187 #define XHCI_DEVICE_CTX_SIZE(hc) ((1 + XHCI_EP_COUNT) * XHCI_ONE_CTX_SIZE(hc)) 187 #define XHCI_GET_EP_CTX(dev_ctx, hc, dci) ((xhci_ep_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), (dci))) 188 #define XHCI_GET_SLOT_CTX(dev_ctx, hc) ((xhci_slot_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), 0)) 188 #define XHCI_GET_EP_CTX(dev_ctx, hc, dci) \ 189 ((xhci_ep_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), (dci))) 190 #define XHCI_GET_SLOT_CTX(dev_ctx, hc) \ 191 ((xhci_slot_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), 0)) 189 192 190 193 /** … … 210 213 typedef struct xhci_stream_ctx { 211 214 uint64_t data [2]; 212 #define XHCI_STREAM_DCS(ctx) 213 #define XHCI_STREAM_SCT(ctx) 214 #define XHCI_STREAM_DEQ_PTR(ctx) 215 #define XHCI_STREAM_EDTLA(ctx) 215 #define XHCI_STREAM_DCS(ctx) XHCI_QWORD_EXTRACT((ctx).data[0], 0, 0) 216 #define XHCI_STREAM_SCT(ctx) XHCI_QWORD_EXTRACT((ctx).data[0], 3, 1) 217 #define XHCI_STREAM_DEQ_PTR(ctx) (XHCI_QWORD_EXTRACT((ctx).data[0], 63, 4) << 4) 218 #define XHCI_STREAM_EDTLA(ctx) XHCI_QWORD_EXTRACT((ctx).data[1], 24, 0) 216 219 217 220 #define XHCI_STREAM_SCT_SET(ctx, val) \ … … 232 235 uint32_t data [8]; 233 236 #define XHCI_INPUT_CTRL_CTX_DROP(ctx, idx) \ 234 237 XHCI_DWORD_EXTRACT((ctx).data[0], (idx), (idx)) 235 238 236 239 #define XHCI_INPUT_CTRL_CTX_DROP_SET(ctx, idx) (ctx).data[0] |= (1 << (idx)) … … 238 241 239 242 #define XHCI_INPUT_CTRL_CTX_ADD(ctx, idx) \ 240 243 XHCI_DWORD_EXTRACT((ctx).data[1], (idx), (idx)) 241 244 242 245 #define XHCI_INPUT_CTRL_CTX_ADD_SET(ctx, idx) (ctx).data[1] |= (1 << (idx)) 243 246 #define XHCI_INPUT_CTRL_CTX_ADD_CLEAR(ctx, idx) (ctx).data[1] &= ~(1 << (idx)) 244 247 245 #define XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx) XHCI_DWORD_EXTRACT((ctx).data[7], 7, 0) 246 #define XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx) XHCI_DWORD_EXTRACT((ctx).data[7], 15, 8) 247 #define XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx) XHCI_DWORD_EXTRACT((ctx).data[7], 23, 16) 248 #define XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx) \ 249 XHCI_DWORD_EXTRACT((ctx).data[7], 7, 0) 250 #define XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx) \ 251 XHCI_DWORD_EXTRACT((ctx).data[7], 15, 8) 252 #define XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx) \ 253 XHCI_DWORD_EXTRACT((ctx).data[7], 23, 16) 248 254 } __attribute__((packed)) xhci_input_ctrl_ctx_t; 249 255 … … 252 258 */ 253 259 #define XHCI_INPUT_CTX_SIZE(hc) (XHCI_ONE_CTX_SIZE(hc) + XHCI_DEVICE_CTX_SIZE(hc)) 254 #define XHCI_GET_CTRL_CTX(ictx, hc) ((xhci_input_ctrl_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 0)) 255 #define XHCI_GET_DEVICE_CTX(dev_ctx, hc) ((xhci_device_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 1)) 260 #define XHCI_GET_CTRL_CTX(ictx, hc) \ 261 ((xhci_input_ctrl_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 0)) 262 #define XHCI_GET_DEVICE_CTX(dev_ctx, hc) \ 263 ((xhci_device_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 1)) 256 264 257 265 typedef struct xhci_input_ctx { -
uspace/drv/bus/usb/xhci/hw_struct/trb.h
r3692678 rae3a941 160 160 * The Chain bit is valid only in specific TRB types. 161 161 */ 162 static inline bool xhci_trb_is_chained(xhci_trb_t *trb) { 162 static inline bool xhci_trb_is_chained(xhci_trb_t *trb) 163 { 163 164 const int type = TRB_TYPE(*trb); 164 165 const bool chain_bit = XHCI_DWORD_EXTRACT(trb->control, 4, 4); -
uspace/drv/bus/usb/xhci/isoch.h
r3692678 rae3a941 84 84 fibril_timer_t *reset_timer; 85 85 86 /** The maximum size of an isochronous transfer and therefore the size of buffers */ 86 /** 87 * The maximum size of an isochronous transfer 88 * and therefore the size of buffers 89 */ 87 90 size_t max_size; 88 91 … … 123 126 extern errno_t isoch_schedule_out(xhci_transfer_t *); 124 127 extern errno_t isoch_schedule_in(xhci_transfer_t *); 125 extern void isoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *, xhci_trb_t *); 128 extern void isoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *, 129 xhci_trb_t *); 126 130 127 131 #endif -
uspace/drv/bus/usb/xhci/main.c
r3692678 rae3a941 68 68 } 69 69 70 static errno_t hcd_irq_code_gen(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq) 70 static errno_t hcd_irq_code_gen(irq_code_t *code, hc_device_t *hcd, 71 const hw_res_list_parsed_t *hw_res, int *irq) 71 72 { 72 73 xhci_hc_t *hc = hcd_to_hc(hcd); -
uspace/drv/bus/usb/xhci/streams.h
r3692678 rae3a941 48 48 xhci_trb_ring_t ring; 49 49 50 /** Pointer to the array of secondary stream context data for primary data. */ 50 /** 51 * Pointer to the array of secondary stream context data for primary 52 * data. 53 */ 51 54 xhci_stream_data_t *secondary_data; 52 55 … … 61 64 } xhci_stream_data_t; 62 65 63 extern xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t * ep, uint32_t stream_id);64 extern void xhci_stream_free_ds(xhci_endpoint_t * xhci_ep);66 extern xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t *, uint32_t); 67 extern void xhci_stream_free_ds(xhci_endpoint_t *); 65 68 66 extern errno_t xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep); 67 extern errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev, 68 xhci_endpoint_t *xhci_ep, unsigned count); 69 extern errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev, 70 xhci_endpoint_t *xhci_ep, unsigned *sizes, unsigned count); 69 extern errno_t xhci_endpoint_remove_streams(xhci_hc_t *, xhci_device_t *, 70 xhci_endpoint_t *); 71 extern errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *, 72 xhci_device_t *, xhci_endpoint_t *, unsigned); 73 extern errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *, 74 xhci_device_t *, xhci_endpoint_t *, unsigned *, unsigned); 71 75 72 76 #endif -
uspace/drv/bus/usb/xhci/transfers.h
r3692678 rae3a941 59 59 extern void xhci_transfer_destroy(usb_transfer_batch_t *); 60 60 61 static inline xhci_transfer_t *xhci_transfer_from_batch(usb_transfer_batch_t *batch) 61 static inline xhci_transfer_t *xhci_transfer_from_batch( 62 usb_transfer_batch_t *batch) 62 63 { 63 64 assert(batch); -
uspace/drv/bus/usb/xhci/trb_ring.h
r3692678 rae3a941 57 57 */ 58 58 typedef struct xhci_trb_ring { 59 list_t segments; /* List of assigned segments */60 int segment_count; /* Number of segments assigned */59 list_t segments; /**< List of assigned segments */ 60 int segment_count; /**< Number of segments assigned */ 61 61 62 /* 63 * As the link TRBs connect physical addresses, we need to keep track of64 * active segment in virtual memory. The enqueue ptr should always belong65 * to the enqueue segment.62 /** 63 * As the link TRBs connect physical addresses, we need to keep track 64 * of active segment in virtual memory. The enqueue ptr should always 65 * belong to the enqueue segment. 66 66 */ 67 67 trb_segment_t *enqueue_segment; 68 68 xhci_trb_t *enqueue_trb; 69 69 70 uintptr_t dequeue; /*Last reported position of the dequeue pointer */71 bool pcs; /*Producer Cycle State: section 4.9.2 */70 uintptr_t dequeue; /**< Last reported position of the dequeue pointer */ 71 bool pcs; /**< Producer Cycle State: section 4.9.2 */ 72 72 73 73 fibril_mutex_t guard; … … 76 76 extern errno_t xhci_trb_ring_init(xhci_trb_ring_t *, size_t); 77 77 extern void xhci_trb_ring_fini(xhci_trb_ring_t *); 78 extern errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *, uintptr_t *); 79 extern errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *, xhci_trb_t *, size_t, uintptr_t *); 78 extern errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *, 79 uintptr_t *); 80 extern errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *, xhci_trb_t *, 81 size_t, uintptr_t *); 80 82 extern size_t xhci_trb_ring_size(xhci_trb_ring_t *); 81 83 82 extern void xhci_trb_ring_reset_dequeue_state(xhci_trb_ring_t * ring, uintptr_t *addr);84 extern void xhci_trb_ring_reset_dequeue_state(xhci_trb_ring_t *, uintptr_t *); 83 85 84 86 /** … … 86 88 * pointer inside the ring. Otherwise, the ring will soon show up as full. 87 89 */ 88 static inline void xhci_trb_ring_update_dequeue(xhci_trb_ring_t *ring, uintptr_t phys) 90 static inline void xhci_trb_ring_update_dequeue(xhci_trb_ring_t *ring, 91 uintptr_t phys) 89 92 { 90 93 ring->dequeue = phys; … … 95 98 */ 96 99 typedef struct xhci_event_ring { 97 list_t segments; /* List of assigned segments */98 int segment_count; /* Number of segments assigned */100 list_t segments; /**< List of assigned segments */ 101 int segment_count; /**< Number of segments assigned */ 99 102 100 trb_segment_t *dequeue_segment; /* Current segment of the dequeue ptr*/101 xhci_trb_t *dequeue_trb; /* Next TRB to be processed */102 uintptr_t dequeue_ptr; /* Physical address of theERDP to be reported to the HC */103 trb_segment_t *dequeue_segment; /**< Current segment */ 104 xhci_trb_t *dequeue_trb; /**< Next TRB to be processed */ 105 uintptr_t dequeue_ptr; /**< Physical ERDP to be reported to the HC */ 103 106 104 dma_buffer_t erst; /*ERST given to the HC */107 dma_buffer_t erst; /**< ERST given to the HC */ 105 108 106 bool ccs; /*Consumer Cycle State: section 4.9.2 */109 bool ccs; /**< Consumer Cycle State: section 4.9.2 */ 107 110 108 111 fibril_mutex_t guard;
Note:
See TracChangeset
for help on using the changeset viewer.