Changes in uspace/drv/uhci-hcd/iface.c [357a302:1ae51ae] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/iface.c
r357a302 r1ae51ae 32 32 * @brief UHCI driver 33 33 */ 34 #include <d river.h>34 #include <ddf/driver.h> 35 35 #include <remote_usbhc.h> 36 36 … … 41 41 #include "iface.h" 42 42 #include "uhci.h" 43 44 /*----------------------------------------------------------------------------*/ 45 static int reserve_default_address(device_t *dev, usb_speed_t speed) 46 { 47 assert(dev); 48 uhci_t *hc = dev_to_uhci(dev); 49 assert(hc); 50 usb_address_keeping_reserve_default(&hc->address_manager); 51 return EOK; 52 } 53 /*----------------------------------------------------------------------------*/ 54 static int release_default_address(device_t *dev) 55 { 56 assert(dev); 57 uhci_t *hc = dev_to_uhci(dev); 58 assert(hc); 59 usb_address_keeping_release_default(&hc->address_manager); 60 return EOK; 61 } 62 /*----------------------------------------------------------------------------*/ 63 static int request_address(device_t *dev, usb_speed_t speed, 43 #include "utils/device_keeper.h" 44 45 /*----------------------------------------------------------------------------*/ 46 static int reserve_default_address(ddf_fun_t *fun, usb_speed_t speed) 47 { 48 assert(fun); 49 uhci_t *hc = fun_to_uhci(fun); 50 assert(hc); 51 usb_log_debug("Default address request with speed %d.\n", speed); 52 device_keeper_reserve_default(&hc->device_manager, speed); 53 return EOK; 54 } 55 /*----------------------------------------------------------------------------*/ 56 static int release_default_address(ddf_fun_t *fun) 57 { 58 assert(fun); 59 uhci_t *hc = fun_to_uhci(fun); 60 assert(hc); 61 usb_log_debug("Default address release.\n"); 62 device_keeper_release_default(&hc->device_manager); 63 return EOK; 64 } 65 /*----------------------------------------------------------------------------*/ 66 static int request_address(ddf_fun_t *fun, usb_speed_t speed, 64 67 usb_address_t *address) 65 68 { 66 assert(dev); 67 uhci_t *hc = dev_to_uhci(dev); 68 assert(hc); 69 *address = usb_address_keeping_request(&hc->address_manager); 69 assert(fun); 70 uhci_t *hc = fun_to_uhci(fun); 71 assert(hc); 72 assert(address); 73 74 usb_log_debug("Address request with speed %d.\n", speed); 75 *address = device_keeper_request(&hc->device_manager, speed); 76 usb_log_debug("Address request with result: %d.\n", *address); 70 77 if (*address <= 0) 71 78 return *address; … … 74 81 /*----------------------------------------------------------------------------*/ 75 82 static int bind_address( 76 device_t *dev, usb_address_t address, devman_handle_t handle) 77 { 78 assert(dev); 79 uhci_t *hc = dev_to_uhci(dev); 80 assert(hc); 81 usb_address_keeping_devman_bind(&hc->address_manager, address, handle); 82 return EOK; 83 } 84 /*----------------------------------------------------------------------------*/ 85 static int release_address(device_t *dev, usb_address_t address) 86 { 87 assert(dev); 88 uhci_t *hc = dev_to_uhci(dev); 89 assert(hc); 90 usb_address_keeping_release_default(&hc->address_manager); 91 return EOK; 92 } 93 /*----------------------------------------------------------------------------*/ 94 static int interrupt_out(device_t *dev, usb_target_t target, 95 size_t max_packet_size, 96 void *data, size_t size, 83 ddf_fun_t *fun, usb_address_t address, devman_handle_t handle) 84 { 85 assert(fun); 86 uhci_t *hc = fun_to_uhci(fun); 87 assert(hc); 88 usb_log_debug("Address bind %d-%d.\n", address, handle); 89 device_keeper_bind(&hc->device_manager, address, handle); 90 return EOK; 91 } 92 /*----------------------------------------------------------------------------*/ 93 static int release_address(ddf_fun_t *fun, usb_address_t address) 94 { 95 assert(fun); 96 uhci_t *hc = fun_to_uhci(fun); 97 assert(hc); 98 usb_log_debug("Address release %d.\n", address); 99 device_keeper_release(&hc->device_manager, address); 100 return EOK; 101 } 102 /*----------------------------------------------------------------------------*/ 103 static int interrupt_out(ddf_fun_t *fun, usb_target_t target, 104 size_t max_packet_size, void *data, size_t size, 97 105 usbhc_iface_transfer_out_callback_t callback, void *arg) 98 106 { 99 dev_speed_t speed = FULL_SPEED; 100 101 batch_t *batch = batch_get(dev, target, USB_TRANSFER_INTERRUPT, 107 assert(fun); 108 uhci_t *hc = fun_to_uhci(fun); 109 assert(hc); 110 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 111 112 usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n", 113 target.address, target.endpoint, size, max_packet_size); 114 115 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 102 116 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg); 103 117 if (!batch) … … 107 121 } 108 122 /*----------------------------------------------------------------------------*/ 109 static int interrupt_in(device_t *dev, usb_target_t target, 110 size_t max_packet_size, 111 void *data, size_t size, 123 static int interrupt_in(ddf_fun_t *fun, usb_target_t target, 124 size_t max_packet_size, void *data, size_t size, 112 125 usbhc_iface_transfer_in_callback_t callback, void *arg) 113 126 { 114 dev_speed_t speed = FULL_SPEED; 115 116 batch_t *batch = batch_get(dev, target, USB_TRANSFER_INTERRUPT, 127 assert(fun); 128 uhci_t *hc = fun_to_uhci(fun); 129 assert(hc); 130 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 131 usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n", 132 target.address, target.endpoint, size, max_packet_size); 133 134 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 117 135 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg); 118 136 if (!batch) … … 122 140 } 123 141 /*----------------------------------------------------------------------------*/ 124 static int control_write(d evice_t *dev, usb_target_t target,142 static int control_write(ddf_fun_t *fun, usb_target_t target, 125 143 size_t max_packet_size, 126 144 void *setup_data, size_t setup_size, void *data, size_t size, 127 145 usbhc_iface_transfer_out_callback_t callback, void *arg) 128 146 { 129 dev_speed_t speed = FULL_SPEED; 130 131 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL, 147 assert(fun); 148 uhci_t *hc = fun_to_uhci(fun); 149 assert(hc); 150 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 151 usb_log_debug("Control WRITE %d:%d %zu(%zu).\n", 152 target.address, target.endpoint, size, max_packet_size); 153 154 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 132 155 max_packet_size, speed, data, size, setup_data, setup_size, 133 156 NULL, callback, arg); … … 138 161 } 139 162 /*----------------------------------------------------------------------------*/ 140 static int control_read(d evice_t *dev, usb_target_t target,163 static int control_read(ddf_fun_t *fun, usb_target_t target, 141 164 size_t max_packet_size, 142 165 void *setup_data, size_t setup_size, void *data, size_t size, 143 166 usbhc_iface_transfer_in_callback_t callback, void *arg) 144 167 { 145 dev_speed_t speed = FULL_SPEED; 146 147 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL, 168 assert(fun); 169 uhci_t *hc = fun_to_uhci(fun); 170 assert(hc); 171 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 172 173 usb_log_debug("Control READ %d:%d %zu(%zu).\n", 174 target.address, target.endpoint, size, max_packet_size); 175 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 148 176 max_packet_size, speed, data, size, setup_data, setup_size, callback, 149 177 NULL, arg);
Note:
See TracChangeset
for help on using the changeset viewer.