Changeset 73a5857 in mainline for uspace/drv
- Timestamp:
- 2018-01-31T23:31:05Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 53fdf8c
- Parents:
- 2ca5a198
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/hc.c
r2ca5a198 r73a5857 277 277 goto err_cmd; 278 278 279 fid_t fid =fibril_create(&event_worker, hc);280 if (! fid)279 hc->event_worker = joinable_fibril_create(&event_worker, hc); 280 if (!hc->event_worker) 281 281 goto err_bus; 282 282 283 // TODO: completion_reset284 hc->event_fibril_completion.active = true;285 fibril_mutex_initialize(&hc->event_fibril_completion.guard);286 fibril_condvar_initialize(&hc->event_fibril_completion.cv);287 288 283 xhci_sw_ring_init(&hc->sw_ring, PAGE_SIZE / sizeof(xhci_trb_t)); 289 284 290 fibril_add_ready(fid);285 joinable_fibril_start(hc->event_worker); 291 286 292 287 return EOK; … … 598 593 } 599 594 600 // TODO: completion_complete 601 fibril_mutex_lock(&hc->event_fibril_completion.guard); 602 hc->event_fibril_completion.active = false; 603 fibril_condvar_broadcast(&hc->event_fibril_completion.cv); 604 fibril_mutex_unlock(&hc->event_fibril_completion.guard); 605 606 return EOK; 595 return 0; 607 596 } 608 597 … … 688 677 { 689 678 xhci_sw_ring_stop(&hc->sw_ring); 690 691 // TODO: completion_wait 692 fibril_mutex_lock(&hc->event_fibril_completion.guard); 693 while (hc->event_fibril_completion.active) 694 fibril_condvar_wait(&hc->event_fibril_completion.cv, 695 &hc->event_fibril_completion.guard); 696 fibril_mutex_unlock(&hc->event_fibril_completion.guard); 679 joinable_fibril_join(hc->event_worker); 697 680 xhci_sw_ring_fini(&hc->sw_ring); 698 681 -
uspace/drv/bus/usb/xhci/hc.h
r2ca5a198 r73a5857 39 39 #include <fibril_synch.h> 40 40 #include <usb/host/usb_transfer_batch.h> 41 #include <usb/host/utility.h> 41 42 #include "hw_struct/regs.h" 42 43 #include "hw_struct/context.h" … … 78 79 xhci_sw_ring_t sw_ring; 79 80 80 struct { 81 fibril_mutex_t guard; 82 fibril_condvar_t cv; 83 bool active; 84 } event_fibril_completion; 81 /** Event handling fibril */ 82 joinable_fibril_t *event_worker; 85 83 86 84 /* Root hub emulation */ -
uspace/drv/bus/usb/xhci/rh.c
r2ca5a198 r73a5857 96 96 } 97 97 98 fid_t fid =fibril_create(&rh_worker, rh);99 if (! fid) {98 rh->event_worker = joinable_fibril_create(&rh_worker, rh); 99 if (!rh->event_worker) { 100 100 free(rh->ports); 101 101 return err; … … 113 113 xhci_sw_ring_init(&rh->event_ring, rh->max_ports); 114 114 115 hc->event_fibril_completion.active = true; 116 fibril_mutex_initialize(&hc->event_fibril_completion.guard); 117 fibril_condvar_initialize(&hc->event_fibril_completion.cv); 118 119 fibril_add_ready(fid); 115 joinable_fibril_start(rh->event_worker); 120 116 121 117 return EOK; … … 132 128 133 129 xhci_sw_ring_stop(&rh->event_ring); 134 135 // TODO: completion_wait 136 fibril_mutex_lock(&rh->event_fibril_completion.guard); 137 while (rh->event_fibril_completion.active) 138 fibril_condvar_wait(&rh->event_fibril_completion.cv, 139 &rh->event_fibril_completion.guard); 140 fibril_mutex_unlock(&rh->event_fibril_completion.guard); 130 joinable_fibril_join(rh->event_worker); 141 131 xhci_sw_ring_fini(&rh->event_ring); 142 132 return EOK; … … 332 322 } 333 323 334 // TODO: completion_complete 335 fibril_mutex_lock(&rh->event_fibril_completion.guard); 336 rh->event_fibril_completion.active = false; 337 fibril_condvar_broadcast(&rh->event_fibril_completion.cv); 338 fibril_mutex_unlock(&rh->event_fibril_completion.guard); 339 340 return EOK; 324 return 0; 341 325 } 342 326 -
uspace/drv/bus/usb/xhci/rh.h
r2ca5a198 r73a5857 37 37 #define XHCI_RH_H 38 38 39 #include <usb/host/bus.h> 39 40 #include <usb/host/usb_transfer_batch.h> 40 #include <usb/host/ bus.h>41 #include <usb/host/utility.h> 41 42 42 43 #include "hw_struct/regs.h" … … 77 78 xhci_sw_ring_t event_ring; 78 79 79 struct { 80 fibril_mutex_t guard; 81 fibril_condvar_t cv; 82 bool active; 83 } event_fibril_completion; 80 joinable_fibril_t *event_worker; 84 81 } xhci_rh_t; 85 82
Note:
See TracChangeset
for help on using the changeset viewer.