Changeset 8ad2b0a in mainline for uspace/drv/bus/usb/ehci/hc.c
- Timestamp:
- 2018-01-17T17:55:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 94f8c363
- Parents:
- d60115a
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-17 17:54:41)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-17 17:55:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
rd60115a r8ad2b0a 173 173 + EHCI_RD8(instance->caps->caplength)); 174 174 175 list_initialize(&instance->pending_ batches);175 list_initialize(&instance->pending_endpoints); 176 176 fibril_mutex_initialize(&instance->guard); 177 177 fibril_condvar_initialize(&instance->async_doorbell); … … 299 299 } 300 300 301 endpoint_t * const ep = batch->ep; 302 ehci_endpoint_t * const ehci_ep = ehci_endpoint_get(ep); 303 304 /* creating local reference */ 305 endpoint_add_ref(ep); 306 307 fibril_mutex_lock(&ep->guard); 308 endpoint_activate_locked(ep, batch); 309 301 310 ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch); 302 303 311 const int err = ehci_transfer_batch_prepare(ehci_batch); 304 if (err) 312 if (err) { 313 endpoint_deactivate_locked(ep); 314 fibril_mutex_unlock(&ep->guard); 315 /* dropping local reference */ 316 endpoint_del_ref(ep); 305 317 return err; 306 318 } 319 320 usb_log_debug("HC(%p): Committing BATCH(%p)", hc, batch); 321 ehci_transfer_batch_commit(ehci_batch); 322 fibril_mutex_unlock(&ep->guard); 323 324 /* Enqueue endpoint to the checked list */ 307 325 fibril_mutex_lock(&hc->guard); 308 326 usb_log_debug2("HC(%p): Appending BATCH(%p)", hc, batch); 309 list_append(&ehci_batch->link, &hc->pending_batches); 310 usb_log_debug("HC(%p): Committing BATCH(%p)", hc, batch); 311 ehci_transfer_batch_commit(ehci_batch); 312 327 328 /* local reference -> pending list reference */ 329 list_append(&ehci_ep->pending_link, &hc->pending_endpoints); 313 330 fibril_mutex_unlock(&hc->guard); 331 314 332 return EOK; 315 333 } … … 341 359 342 360 if (status & (USB_STS_IRQ_FLAG | USB_STS_ERR_IRQ_FLAG)) { 361 362 LIST_INITIALIZE(completed); 363 343 364 fibril_mutex_lock(&hc->guard); 344 365 345 usb_log_debug2("HC(%p): Scanning %lu pending batches", hc, 346 list_count(&hc->pending_batches)); 347 list_foreach_safe(hc->pending_batches, current, next) { 348 ehci_transfer_batch_t *batch = 349 ehci_transfer_batch_from_link(current); 366 usb_log_debug2("HC(%p): Scanning %lu pending endpoints", hc, 367 list_count(&hc->pending_endpoints)); 368 list_foreach_safe(hc->pending_endpoints, current, next) { 369 ehci_endpoint_t *ep 370 = list_get_instance(current, ehci_endpoint_t, pending_link); 371 372 fibril_mutex_lock(&ep->base.guard); 373 ehci_transfer_batch_t *batch 374 = ehci_transfer_batch_get(ep->base.active_batch); 375 assert(batch); 350 376 351 377 if (ehci_transfer_batch_check_completed(batch)) { 378 endpoint_deactivate_locked(&ep->base); 352 379 list_remove(current); 380 endpoint_del_ref(&ep->base); 353 381 usb_transfer_batch_finish(&batch->base); 354 382 } 383 fibril_mutex_unlock(&ep->base.guard); 355 384 } 356 385 fibril_mutex_unlock(&hc->guard); 386 387 357 388 } 358 389
Note:
See TracChangeset
for help on using the changeset viewer.