Changeset ee0ffa6 in mainline
- Timestamp:
- 2018-01-29T15:17:43Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 705f83a
- Parents:
- ddbd088
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
rddbd088 ree0ffa6 460 460 { 461 461 hc_t *instance = hcd_to_hc(hcd); 462 ohci_rh_init(&instance->rh, instance->registers, "ohci rh");462 ohci_rh_init(&instance->rh, instance->registers, &instance->guard, "ohci rh"); 463 463 464 464 /* OHCI guide page 42 */ -
uspace/drv/bus/usb/ohci/ohci_rh.c
rddbd088 ree0ffa6 109 109 * initializes internal virtual hub. 110 110 */ 111 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name) 111 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, 112 fibril_mutex_t *guard, const char *name) 112 113 { 113 114 assert(instance); … … 163 164 ohci_rh_hub_desc_init(instance); 164 165 instance->status_change_endpoint = NULL; 166 instance->guard = guard; 165 167 return virthub_base_init(&instance->base, name, &ops, instance, 166 168 NULL, &instance->hub_descriptor.header, HUB_STATUS_CHANGE_PIPE); … … 183 185 if (batch->error == ENAK) { 184 186 /* Lock the HC guard */ 185 fibril_mutex_lock( batch->ep->guard);187 fibril_mutex_lock(instance->guard); 186 188 const int err = endpoint_activate_locked(batch->ep, batch); 187 189 if (err) { … … 198 200 endpoint_add_ref(batch->ep); 199 201 instance->status_change_endpoint = batch->ep; 200 fibril_mutex_unlock( batch->ep->guard);202 fibril_mutex_unlock(instance->guard); 201 203 } else { 202 204 usb_transfer_batch_finish(batch); … … 214 216 int ohci_rh_interrupt(ohci_rh_t *instance) 215 217 { 218 fibril_mutex_lock(instance->guard); 216 219 endpoint_t *ep = instance->status_change_endpoint; 217 if (!ep) 220 if (!ep) { 221 fibril_mutex_unlock(instance->guard); 218 222 return EOK; 219 220 fibril_mutex_lock(ep->guard); 223 } 224 221 225 usb_transfer_batch_t * const batch = ep->active_batch; 222 226 endpoint_deactivate_locked(ep); 223 227 instance->status_change_endpoint = NULL; 224 fibril_mutex_unlock( ep->guard);228 fibril_mutex_unlock(instance->guard); 225 229 226 230 endpoint_del_ref(ep); -
uspace/drv/bus/usb/ohci/ohci_rh.h
rddbd088 ree0ffa6 63 63 /** A hacky way to emulate interrupts over polling. See ehci_rh. */ 64 64 endpoint_t *status_change_endpoint; 65 fibril_mutex_t *guard; 65 66 } ohci_rh_t; 66 67 67 int ohci_rh_init(ohci_rh_t * instance, ohci_regs_t *regs, const char *name);68 int ohci_rh_init(ohci_rh_t *, ohci_regs_t *, fibril_mutex_t *, const char *); 68 69 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch); 69 70 int ohci_rh_interrupt(ohci_rh_t *instance);
Note:
See TracChangeset
for help on using the changeset viewer.