Changeset 929599a8 in mainline for uspace/drv/bus/usb/uhci/hc.c
- Timestamp:
- 2018-01-11T13:30:37Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ed803f1
- Parents:
- 351113f
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 13:30:31)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 13:30:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
r351113f r929599a8 53 53 54 54 #include "uhci_batch.h" 55 #include "transfer_list.h" 55 56 #include "hc.h" 56 57 … … 323 324 static void endpoint_unregister(endpoint_t *ep) 324 325 { 326 hc_t * const hc = bus_to_hc(endpoint_get_bus(ep)); 325 327 usb2_bus_ops.endpoint_unregister(ep); 328 329 uhci_transfer_batch_t *batch = NULL; 326 330 327 331 fibril_mutex_lock(&ep->guard); 328 332 if (ep->active_batch) { 329 uhci_transfer_batch_t *ub = uhci_transfer_batch_get(ep->active_batch); 330 uhci_transfer_batch_abort(ub); 331 332 assert(ep->active_batch == NULL); 333 batch = uhci_transfer_batch_get(ep->active_batch); 334 335 transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type]; 336 assert(list); 337 338 fibril_mutex_lock(&list->guard); 339 transfer_list_remove_batch(list, batch); 340 fibril_mutex_unlock(&list->guard); 341 342 endpoint_wait_timeout_locked(ep, 2000); 343 344 batch = uhci_transfer_batch_get(ep->active_batch); 345 if (ep->active_batch) { 346 endpoint_deactivate_locked(ep); 347 } 333 348 } 334 349 fibril_mutex_unlock(&ep->guard); 350 351 if (batch) { 352 batch->base.error = EINTR; 353 batch->base.transfered_size = 0; 354 usb_transfer_batch_finish(&batch->base); 355 } 335 356 } 336 357 … … 486 507 static int hc_schedule(usb_transfer_batch_t *batch) 487 508 { 488 assert(batch); 489 hc_t *instance = bus_to_hc(endpoint_get_bus(batch->ep)); 490 491 if (batch->target.address == uhci_rh_get_address(&instance->rh)) 492 return uhci_rh_schedule(&instance->rh, batch); 493 494 uhci_transfer_batch_t *uhci_batch = (uhci_transfer_batch_t *) batch; 495 if (!uhci_batch) { 496 usb_log_error("Failed to create UHCI transfer structures.\n"); 497 return ENOMEM; 498 } 509 uhci_transfer_batch_t *uhci_batch = uhci_transfer_batch_get(batch); 510 endpoint_t *ep = batch->ep; 511 hc_t *hc = bus_to_hc(endpoint_get_bus(ep)); 512 513 if (batch->target.address == uhci_rh_get_address(&hc->rh)) 514 return uhci_rh_schedule(&hc->rh, batch); 515 499 516 500 517 const int err = uhci_transfer_batch_prepare(uhci_batch); … … 502 519 return err; 503 520 504 transfer_list_t *list = 505 instance->transfers[batch->ep->device->speed][batch->ep->transfer_type]; 521 transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type]; 506 522 assert(list); 507 523 transfer_list_add_batch(list, uhci_batch); 524 525 return EOK; 526 } 527 528 int hc_unschedule_batch(usb_transfer_batch_t *batch) 529 { 508 530 509 531 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.