Changes in uspace/drv/ohci/iface.c [592369ae:a19a2d7] in mainline
- File:
-
- 1 edited
-
uspace/drv/ohci/iface.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/iface.c
r592369ae ra19a2d7 55 55 56 56 size_t res_bw; 57 endpoint_t *ep = hc_get_endpoint(*hc,57 endpoint_t *ep = usb_endpoint_manager_get_ep(&(*hc)->ep_manager, 58 58 target.address, target.endpoint, direction, &res_bw); 59 59 if (ep == NULL) { … … 63 63 } 64 64 65 usb_log_debug("%s %d:%d %zu(%zu).\n",66 name, target.address, target.endpoint, size, ep->max_packet_size);67 68 65 const size_t bw = bandwidth_count_usb11( 69 66 ep->speed, ep->transfer_type, size, ep->max_packet_size); … … 71 68 usb_log_error("Endpoint(%d:%d) %s needs %zu bw " 72 69 "but only %zu is reserved.\n", 73 target.address, target.endpoint, name, bw, res_bw);70 name, target.address, target.endpoint, bw, res_bw); 74 71 return ENOSPC; 75 72 } 73 usb_log_debug("%s %d:%d %zu(%zu).\n", 74 name, target.address, target.endpoint, size, ep->max_packet_size); 76 75 77 76 *batch = batch_get( … … 158 157 hc_t *hc = fun_to_hc(fun); 159 158 assert(hc); 160 159 if (address == hc->rh.address) 160 return EOK; 161 161 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address); 162 162 if (speed >= USB_SPEED_MAX) { 163 163 speed = ep_speed; 164 164 } 165 const size_t size = max_packet_size; 165 const size_t size = 166 (transfer_type == USB_TRANSFER_INTERRUPT 167 || transfer_type == USB_TRANSFER_ISOCHRONOUS) ? 168 max_packet_size : 0; 169 int ret; 170 171 endpoint_t *ep = malloc(sizeof(endpoint_t)); 172 if (ep == NULL) 173 return ENOMEM; 174 ret = endpoint_init(ep, address, endpoint, direction, 175 transfer_type, speed, max_packet_size); 176 if (ret != EOK) { 177 free(ep); 178 return ret; 179 } 166 180 167 181 usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n", … … 169 183 usb_str_speed(speed), direction, size, max_packet_size, interval); 170 184 171 return hc_add_endpoint(hc, address, endpoint, speed, transfer_type, 172 direction, max_packet_size, size, interval); 185 ret = usb_endpoint_manager_register_ep(&hc->ep_manager, ep, size); 186 if (ret != EOK) { 187 endpoint_destroy(ep); 188 } 189 return ret; 173 190 } 174 191 /*----------------------------------------------------------------------------*/ … … 181 198 usb_log_debug("Unregister endpoint %d:%d %d.\n", 182 199 address, endpoint, direction); 183 return hc_remove_endpoint(hc, address, endpoint, direction); 200 return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address, 201 endpoint, direction); 184 202 } 185 203 /*----------------------------------------------------------------------------*/ … … 213 231 ret = hc_schedule(hc, batch); 214 232 if (ret != EOK) { 215 usb_transfer_batch_dispose(batch);233 batch_dispose(batch); 216 234 } 217 235 return ret; … … 247 265 ret = hc_schedule(hc, batch); 248 266 if (ret != EOK) { 249 usb_transfer_batch_dispose(batch);267 batch_dispose(batch); 250 268 } 251 269 return ret; … … 281 299 ret = hc_schedule(hc, batch); 282 300 if (ret != EOK) { 283 usb_transfer_batch_dispose(batch);301 batch_dispose(batch); 284 302 } 285 303 return ret; … … 315 333 ret = hc_schedule(hc, batch); 316 334 if (ret != EOK) { 317 usb_transfer_batch_dispose(batch);335 batch_dispose(batch); 318 336 } 319 337 return ret; … … 331 349 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 332 350 * and deallocated by the caller). 333 * @param[in] setup_ size Size of @p setup_packet buffer in bytes.351 * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes. 334 352 * @param[in] data_buffer Data buffer (in USB endianess, allocated and 335 353 * deallocated by the caller). 336 * @param[in] size Size of @p data_buffer buffer in bytes.354 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes. 337 355 * @param[in] callback Callback to be issued once the transfer is complete. 338 356 * @param[in] arg Pass-through argument to the callback. … … 355 373 ret = hc_schedule(hc, batch); 356 374 if (ret != EOK) { 357 usb_transfer_batch_dispose(batch);375 batch_dispose(batch); 358 376 } 359 377 return ret; … … 371 389 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 372 390 * and deallocated by the caller). 373 * @param[in] setup_ size Size of @p setup_packet buffer in bytes.391 * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes. 374 392 * @param[in] data_buffer Buffer where to store the data (in USB endianess, 375 393 * allocated and deallocated by the caller). 376 * @param[in] size Size of @p data_buffer buffer in bytes.394 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes. 377 395 * @param[in] callback Callback to be issued once the transfer is complete. 378 396 * @param[in] arg Pass-through argument to the callback. … … 394 412 ret = hc_schedule(hc, batch); 395 413 if (ret != EOK) { 396 usb_transfer_batch_dispose(batch);414 batch_dispose(batch); 397 415 } 398 416 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.
