Changeset fc0271a5 in mainline
- Timestamp:
- 2017-10-12T16:06:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f9d787c
- Parents:
- d0db4a0
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rd0db4a0 rfc0271a5 442 442 assert(batch); 443 443 444 if (batch->ep-> address == uhci_rh_get_address(&instance->rh))444 if (batch->ep->target.address == uhci_rh_get_address(&instance->rh)) 445 445 return uhci_rh_schedule(&instance->rh, batch); 446 446 -
uspace/drv/bus/usb/uhci/hc.h
rd0db4a0 rfc0271a5 43 43 #include <ddi.h> 44 44 #include <usb/host/hcd.h> 45 #include <usb/host/usb2_bus.h> 45 46 #include <usb/host/usb_transfer_batch.h> 46 47 … … 100 101 typedef struct hc { 101 102 uhci_rh_t rh; 103 usb2_bus_t bus; 102 104 /** Addresses of I/O registers */ 103 105 uhci_regs_t *registers; -
uspace/drv/bus/usb/uhci/main.c
rd0db4a0 rfc0271a5 45 45 #include <usb/debug.h> 46 46 #include <usb/host/ddf_helpers.h> 47 #include <usb/host/bandwidth.h> 47 48 48 49 #include "hc.h" … … 57 58 static const ddf_hc_driver_t uhci_hc_driver = { 58 59 .claim = disable_legacy, 59 .hc_speed = USB_SPEED_FULL,60 60 .irq_code_gen = uhci_hc_gen_irq_code, 61 61 .init = uhci_driver_init, … … 72 72 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res) 73 73 { 74 int err; 75 74 76 assert(hcd); 75 77 assert(hcd_get_driver_data(hcd) == NULL); … … 79 81 return ENOMEM; 80 82 81 const int ret = hc_init(instance, res); 82 if (ret == EOK) { 83 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops); 84 } else { 85 free(instance); 86 } 87 return ret; 83 if ((err = hc_init(instance, res)) != EOK) 84 goto err; 85 86 if ((err = usb2_bus_init(&instance->bus, hcd, BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11))) 87 goto err; 88 89 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops, &instance->bus.base); 90 91 return EOK; 92 93 err: 94 free(instance); 95 return err; 88 96 } 89 97 … … 105 113 hc_fini(hc); 106 114 107 hcd_set_implementation(hcd, NULL, NULL );115 hcd_set_implementation(hcd, NULL, NULL, NULL); 108 116 free(hc); 109 117 } -
uspace/drv/bus/usb/uhci/uhci_batch.c
rd0db4a0 rfc0271a5 228 228 uhci_batch->usb_batch->ep->speed == USB_SPEED_LOW; 229 229 const size_t mps = uhci_batch->usb_batch->ep->max_packet_size; 230 const usb_target_t target = {{ 231 uhci_batch->usb_batch->ep->address, 232 uhci_batch->usb_batch->ep->endpoint }}; 230 const usb_target_t target = uhci_batch->usb_batch->ep->target; 233 231 234 232 int toggle = endpoint_toggle_get(uhci_batch->usb_batch->ep); … … 293 291 uhci_batch->usb_batch->ep->speed == USB_SPEED_LOW; 294 292 const size_t mps = uhci_batch->usb_batch->ep->max_packet_size; 295 const usb_target_t target = {{ 296 uhci_batch->usb_batch->ep->address, 297 uhci_batch->usb_batch->ep->endpoint }}; 293 const usb_target_t target = uhci_batch->usb_batch->ep->target; 298 294 299 295 /* setup stage */ -
uspace/drv/bus/usb/uhci/uhci_rh.c
rd0db4a0 rfc0271a5 103 103 assert(batch); 104 104 105 const usb_target_t target = {{ 106 .address = batch->ep->address, 107 .endpoint = batch->ep->endpoint 108 }}; 105 const usb_target_t target = batch->ep->target; 109 106 do { 110 107 batch->error = virthub_base_request(&instance->base, target, -
uspace/lib/usbhost/include/usb/host/bandwidth.h
rd0db4a0 rfc0271a5 49 49 #define BANDWIDTH_AVAILABLE_USB20 1 50 50 51 extern size_t bandwidth_count_usb11(usb_speed_t, usb_transfer_type_t, size_t, size_t);51 typedef struct endpoint endpoint_t; 52 52 53 extern size_t bandwidth_count_usb20(usb_speed_t, usb_transfer_type_t, size_t, size_t); 53 extern size_t bandwidth_count_usb11(endpoint_t *, size_t); 54 55 extern size_t bandwidth_count_usb20(endpoint_t *, size_t); 54 56 55 57 #endif -
uspace/lib/usbhost/include/usb/host/hcd.h
rd0db4a0 rfc0271a5 58 58 /** Transfer scheduling, implement in device driver. */ 59 59 schedule_hook_t schedule; 60 /** Hook called upon registering new endpoint. */61 ep_add_hook_t ep_add_hook;62 /** Hook called upon removing of an endpoint. */63 ep_remove_hook_t ep_remove_hook;64 60 /** Hook to be called on device interrupt, passes ARG1 */ 65 61 interrupt_hook_t irq_hook; -
uspace/lib/usbhost/include/usb/host/usb2_bus.h
rd0db4a0 rfc0271a5 50 50 /** Endpoint management structure */ 51 51 typedef struct usb2_bus { 52 bus_t b us; /**< Inheritance - keep this first */52 bus_t base; /**< Inheritance - keep this first */ 53 53 54 54 /* Device bookkeeping */ -
uspace/lib/usbhost/src/bandwidth.c
rd0db4a0 rfc0271a5 35 35 36 36 #include <usb/host/bandwidth.h> 37 #include <usb/host/endpoint.h> 37 38 38 39 #include <assert.h> … … 46 47 * @param max_packet_size Maximum bytes in one packet. 47 48 */ 48 size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type, 49 size_t size, size_t max_packet_size) 49 size_t bandwidth_count_usb11(endpoint_t *ep, size_t size) 50 50 { 51 assert(ep); 52 53 const usb_transfer_type_t type = ep->transfer_type; 54 51 55 /* We care about bandwidth only for interrupt and isochronous. */ 52 56 if ((type != USB_TRANSFER_INTERRUPT) … … 55 59 } 56 60 61 const size_t max_packet_size = ep->max_packet_size; 62 57 63 const unsigned packet_count = 58 64 (size + max_packet_size - 1) / max_packet_size; … … 60 66 * transaction, but I did not find text in USB spec to confirm this */ 61 67 /* NOTE: All data packets will be considered to be max_packet_size */ 62 switch ( speed)68 switch (ep->speed) 63 69 { 64 70 case USB_SPEED_LOW: … … 94 100 * @param max_packet_size Maximum bytes in one packet. 95 101 */ 96 size_t bandwidth_count_usb20(usb_speed_t speed, usb_transfer_type_t type, 97 size_t size, size_t max_packet_size) 102 size_t bandwidth_count_usb20(endpoint_t *ep, size_t size) 98 103 { 104 assert(ep); 105 106 const usb_transfer_type_t type = ep->transfer_type; 107 99 108 /* We care about bandwidth only for interrupt and isochronous. */ 100 109 if ((type != USB_TRANSFER_INTERRUPT) -
uspace/lib/usbhost/src/usb2_bus.c
rd0db4a0 rfc0271a5 291 291 assert(bus); 292 292 293 bus_init(&bus->b us, hcd);294 295 bus->b us.ops = usb2_bus_ops;296 bus->b us.ops.count_bw = count_bw;293 bus_init(&bus->base, hcd); 294 295 bus->base.ops = usb2_bus_ops; 296 bus->base.ops.count_bw = count_bw; 297 297 298 298 bus->free_bw = available_bandwidth;
Note:
See TracChangeset
for help on using the changeset viewer.